Pregunta

What is the purpose of using @media screen?

I'm new to using @media queries and I don't understand as to why you would need screen.

@media print I can understand as it allows you to alter the code when it comes to printing a page but surely screen would just give the same output as using standard css? e.g.:

@media screen { #id {display:none; } }

vs

#id {display:none; }

Surely you would just get the same output so what would be the benefit of screen?

Is there another benefit to it that I don't understand?

¿Fue útil?

Solución

This will not match when the current media is not screen, e.g. when printing or projecting.

You are assuming that screen is the default, and all the others are exceptions, overriding with more specific rules, but the actual default is @media all.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top