DEV Community

SARTHAK KASHMIRA
SARTHAK KASHMIRA

Posted on

Combinators in CSS

The use of combinators in CSS can make the HTML codes look better and less bulky.
Some of the areas where you can use them are
The code
<ul class="navbar-list">
<li class="list-item"><a href="" >Men</a></li>
<li class="list-item"><a href="" >Women</a></li>
<li class="list-item"><a href="" >Kids</a></li>
</ul>

can be made to
<ul class="navbar-list">
<li><a href="" >Men</a></li>
<li><a href="" >Women</a></li>
<li><a href="" >Kids</a></li>
</ul>

if we use .navbar-list > li { .. your css code } rather than .list-item{.. your css code..}

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more