Some handy CSS tricks
Let’s discover some nice but less-known CSS feature!
Any web developer knows the irreplaceable trio of programming languages: HTML, CSS and JavaScript. Those are the base skills you’ll need as soon as you start making websites or web apps…
… but do you really know these tools? For example, how much do you know about CSS?
Today, I’m going to share a few handy tips and features that might help you boost your styles and designs, or create dynamic content only with CSS! :)
Setting multiple classes on an element
You might be familiar with the CSS pattern where you assign the same style to multiple elements, using a comma ,
:
#my-id, .my-class, .my-other-class {
color: red;
font-weight: bold;
}
But it’s just as easy to do the reverse and assign multiple styles to a given element — for example, you can easily give several classes to a tag by separating them with spaces:
If you want some style to apply only when there are at least a set of specific classes, you need to put all the required selectors next…