Aninhando regras @media em CSS
O suporte parece ser diferente entre os navegadores.
Verifica aligação
Firefox: preto com texto branco.
Opera, Chrome, IE9: azul com texto em preto.
O que é correto e como eu faria isso consistente?
O 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 as consultas de mídia de aninhamento dentro de uma@import
parece funcionar.
por exemplo:
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;
}
}