why is only screen needed in media queries code example

Example: media query only screen

@media not|only mediatype and (mediafeature and|or|not mediafeature) {
  CSS-Code;
}

meaning of the not, only and and keywords:

not: The not keyword inverts the meaning of an entire media query.

only: The only keyword prevents older browsers that do not support media queries with media features from applying the specified styles. It has no effect on modern browsers.

and: The and keyword combines a media feature with a media type or other media features.

They are all optional. However, if you use not or only, you must also specify a media type.

Tags:

Css Example