The @media
CSS at-rule
associates a set of nested statements.
The following code shows how to use CSS @media rule.
@media <media-query> { /* media-specific rules */ }
A media-query
is composed of a media type and/or a number of media features.
The following code shows how to use Media types.
<!DOCTYPE html>
<html>
<head>
<style>
@media screen {<!--from w w w .j a va2 s.c o m-->
h2 {
font-family: verdana,sans-serif;
font-size: 14px;
}
}
@media print {
h2 {
font-size: 20px;
color: red;
}
}
</style>
</head>
<body>
<h2>The @media Rule</h2>
</body>
</html>