I wanted to know which would be best practice for media queries.
If you were to target a screen size I would generally do something like:
section#about {
background-color: yellow;
color: black;
padding: 5px 20px;
@media (max-width: 600px) {
padding: 0;
}
}
.button-small {
margin-bottom: 12px;
@media (max-width: 600px) {
margin-bottom: 6px;
}
}
Would the following be better:
section#about {
background-color: yellow;
color: black;
padding: 5px 20px;
}
@media (max-width: 600px) {
section#about {
padding: 0;
}
}
.button-small {
margin-bottom: 12px;
}
@media (max-width: 600px) {
.button-small {
margin-bottom: 6px;
}
}
Instead of nesting @media queries inside classes, you would create a standalone @media query and add the class you would need changed?
NB: Sorry all, I'm using a preprocessor (SASS). I'm thinking of ways to organize code legibility.