mediatype

suggest change

Media queries have an optional mediatype parameter. This parameter is placed directly after the @media declaration (@media mediatype), for example:

@media print {
    html {
        background-color: white;
    }
}

The above CSS code will give the DOM HTML element a white background color when being printed.

The mediatype parameter has an optional not or only prefix that will apply the styles to everything except the specified mediatype or only the specified media type, respectively. For example, the following code example will apply the style to every media type except print.

@media not print {
    html {
        background-color: green;
    }
}

And the same way, for just showing it only on the screen, this can be used:

@media only screen {
    .fadeInEffects {
        display: block;
    }
}

The media types still used in practice are:

Media type Description
all Every device. This is the default when the type is omitted.
screen Screens, including typical computer and phone displays.
print Paged printed output, and print preview.
speech Speech synthesizers. This replaces the old aural type.

handheld, projection, aural, braille, embossed, tv, and tty are deprecated. Phones match screen, not handheld. Do not use those legacy types to target devices.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents