3 ms·
nope. you've got a couple of options - .info { font-size: 8px; } .news { color: black; } <div class="info news">asdf</div> or maybe
by mock-possum 4y ago
nope. you've got a couple of options -
.info {
font-size: 8px;
}
.news {
color: black;
}
<div class="info news">asdf</div>
or maybe
.info {
font-size: 8px;
}
.news {
color: black;
}
<div class="news"><p class="info">asdf</p></div>
or even
.info, .news {
font-size: 8px;
}
.news {
color: black;
}
<div class="news">asdf</div>
but you've got to use LESS/SCSS for true 'extends' type functionality. vanilla CSS is more focused on inheritance.
- TekMol 4y agoOut of these, only the last one seems somewhat okish to me. But it would be annoying to add another selector everytime you add a class that uses the rule. If that is all we have, then I will just stick to css variables: :root { --info-font-size: 8px; } .info { font-size: var(--info-font-size); color: grey; } .news { font-size: var(--info-font-size); color: black; }