Basically, I want to add the border-top: 3px
only if .title
.lengthyText #childmenuList
has the #highLayer
id attribute. If there is no #highLayer
id attribute, then there is no border-top: 3px
.
I know I can use the :has()
pseudo-class to check if #highLayer
is present or not(I showed it below). But say that I can’t use the :has()
pseudo-class, is there another way to write this CSS?
.title.lengthyText:has(#highLayer) #childmenuList {
border-top: 3px;
}
<div class="title lengthyText">
<div class="subcontainer">
<nav id="highLayer" class="high-lay">Nav</nav>
</div>
<div id="childmenuList">child menu</div>
</div>