Nesting @media rules en CSS
El soporte parece ser diferente en todos los navegadores ...
Comprobar elenlazar
Firefox: negro con texto en blanco.
Opera, Chrome, IE9: Azul con texto en negro.
¿Cuál es correcto y cómo lo haría consistente?
El código
@media screen and (min-width: 480px) {
body{
background-color:#6aa6cc;
color:#000;
}
@media screen and (min-width: 768px) {
body{
background-color:#000;
color:#fff;
}
}
}
Curiosamente, parece que las consultas de medios de anidación dentro de un condicional@import
parece funcionar
p.ej:
Index.html<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Media test</title>
<link rel="stylesheet" type="text/css" href="importer.css" />
</head>
<body>
<h1>Why is this not consistent.</h1>
</body>
</html>
importador.css@import url(media.css) screen and (min-width: 480px);
media.cssbody {
background-color: #6aa6cc;
color: #000;
}
@media screen and (min-width:768px) {
body {
background-color: #000;
color: #fff;
}
}