I like LESS. It is simple and has some cool features. I usually try to follow BEM when it comes to define classes and styles – but mixins are great.
To extend the responsive functionality I created a set of media query helpers that can be added to any class:
.sm(@rules) {
@media only screen and (max-width: 40em) {
@rules();
}
}
.md(@rules) {
@media only screen and (min-width: 40.063em) {
@rules();
}
}
.lg(@rules) {
@media only screen and (min-width: 64.063em) {
@rules();
}
}
.xl(@rules) {
@media only screen and (min-width: 90.063em) {
@rules();
}
}
The widths match the PrimeNG grid, I just took the values from there. Now we can just add special rules for each media query.
body {
background-color: #202040;
color: white;
text-transform: uppercase;
font-family: "Baloo Paaji 2", cursive;
font-family: "Roboto", sans-serif;
letter-spacing: 0.5rem;
word-spacing: 1rem;
padding-left: 10%;
padding-right: 10%;
.sm({
padding-left: 0;
padding-right: 0;
});
.md({
padding-left: 10%;
padding-right: 10%;
});
.lg({
padding-left: 20%;
padding-right: 20%;
});
}