I have a lot of classes that end up like.
.img-small {
color: #202124;
display: block;
font-size: 10px;
font-weight: 700;
line-height: 12px;
max-width: 13px;
}
.img-med {
color: #202124;
display: block;
font-size: 10px;
font-weight: 700;
line-height: 12px;
max-width: 23px;
}
In this case the only difference being the width and very often these classes are used for exactly one image.
I'm tempted to use the width property but I know that's deprecated, so then I'm tempted to use a class that all it does is set the width (i.e. class="img-base w-23"), but is there really no better way so that I can override just one field? If possible I'd like to do something like.
.img-small {
color: #202124;
display: block;
font-size: 10px;
font-weight: 700;
line-height: 12px;
max-width: 13px;
}
.img-med = img-small {
max-width: 23px;
}
Is there something like this in vanilla CSS?
.img-small, .img-med {…all properties exceptmax-width…} .img-small { max-width: 13px; } .img-med { max-width: 23px; }?.imgrelated item that contains the settings that would be common for all or most of your image related styles. Then, you could make specific.img-small(using your naming) type items with settings that are different. Later, when you want to use the CSS somewhere, just make sure to include both the common.imgpart as well as the specific.img-smallpart in your HTML or wherever.