My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

How can I simplify CSS declarations?

Hanah Steven's photo
Hanah Steven
·Dec 11, 2018

Pardon me for my beginner question. Is there a way to consolidate the following example?

Example:

.mainnavbar {
    color: #333333; 
}

.footerarea {
    background: #333333;
}

.extracontents {
    border: 0.2rem #333333 solid;
}

#333333 appears in all three declarations, and I'm afraid it is considered redundant. I know Sass and CSS Variables allow me to define the color once and reuse elsewhere, but I would rather not use them for some reasons. I wonder whether I could consolidate them without resorting to SASS or CSS Variables?