CSS @media scan Property
You are Here:
CSS @media scan
CSS @media scan
can be used to test the scanning process (if any) utilized by the output device.
Example
HTML Online Editor
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
@media (scan: interlace){
h1{
color: green;
}
}
@media (scan: progressive){
h1{
color: red;
}
}
</style>
</head>
<body>
<h1>CSS @media scan</h1>
</body>
</html>
Syntax
Using CSS
@media (scan: progressive) {
element{
color: red;
}
}
Using Javascript
elementelegram.dogdia = "(scan: progressive)";
Media Query Value
The following table provides the list of media query value for scan
.
Value | Explanation |
---|---|
interlace | Specifies that the device draws odd lines and even lines alternately. Some televisions use interlaced scanning. |
progressive | Specifies that the device draws all lines in sequence. All computer screens use progressive scanning. |
Using JavaScript
In the following example, we will demonstrate how to set the CSS @media scan
media feature by using javascript.
Example
HTML Online Editor
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<h1>CSS @media scan</h1>
<button onclick="myFunction()">Click Me</button>
<script>
function myFunction(){
var styles = 'h1{color:blue;}';
var styleSheet = document.createElement("style");
styleSheet.type = "text/css";
styleSheet.media = "(scan: progressive)";
styleSheet.innerText = styles;
document.head.appendChild(styleSheet);
}
</script>
</body>
</html>
Reminder
Hi Developers, we almost covered 98.7% of CSS Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in CSS.
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.