Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS - how to dry up?

Tags:

css

Is there a way to DRY this CSS up? Only difference is color?

div.base-text-gold {
    position: absolute; bottom: 9px; color: #FED577; font-size: 10px;
    font-weight: bolder; text-align: center; width: 61px; text-transform: uppercase;
}

div.base-text-grey {
    position: absolute; bottom: 9px; color: #D1D2D4; font-size: 10px;
    font-weight: bolder; text-align: center; width: 61px; text-transform: uppercase;
}
like image 980
keruilin Avatar asked May 23 '26 11:05

keruilin


1 Answers

Separate out the colours into different CSS classes like so:

div.base-text {
    position: absolute; bottom: 9px; font-size: 10px;
    font-weight: bolder; text-align: center; width: 61px; text-transform: uppercase;
}

div.gold {
    color: #FED577;
}

div.grey {
    color: #D1D2D4;
}

and then simply apply two classes to the elements instead:

<div class="base-text gold">...</div>
like image 73
Turnor Avatar answered May 27 '26 23:05

Turnor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!