HTML <style> with media any-pointer
HTML <style> with media any-pointer
The any-pointer
value of the media attribute specifies whether the user has any pointing device (such as a mouse), and if so, how accurate it is.
Example
HTML Online Editor
<!DOCTYPE html>
<html>
<head>
<style media="screen and (any-pointer: fine)">
label{
color:red;
}
#fine{
color:green;
}
#coarse, #none{
color:#fff;
}
</style>
<style media="screen and (any-pointer: none)">
label{
color:green;
}
#none{
color:green;
}
#coarse, #fine{
color:#fff;
}
</style>
<style media="screen and (any-pointer: coarse)">
label{
color:blue;
}
#coarse{
color:green;
}
#none, #fine{
color:#fff;
}
</style>
</head>
<body>
<input id="test" type="checkbox">
<label for="test">Look at me!</label>
<p id="fine">You are using atleast one fine pointer Device</p>
<p id="coarse">You are using atleast one Coarse pointer Device</p>
<p id="none">You are using no pointer Device</p>
</body>
</html>
Attribute Value
Value | Explanation |
---|---|
none | No pointing device is available. |
coarse | At least one input mechanism includes a pointing device of limited accuracy. |
fine | At least one input mechanism includes an accurate pointing device. |
Reminder
Hi Developers, we almost covered 99.5% of HTML Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in HTML.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.