1
I have a menu and I just wanted to specify an element so it does not receive the same properties applied in the others, in case the element would be #Lk "PRODUCTS" it is receiving all attributes that have been applied in other elements, but I don’t intend to apply any kind of attribute to it, as I do to ignore the attributes inserted in it??
body{background-color:#6C9;}
*{ padding:0px; margin:;}
input{ display:none;
}
.menu{ width:100%;
height:52px;
background-color: #333;
font-family:Arial, Helvetica, sans-serif;
}
.menu ul{ list-style:none;
position:relative;
top:2px;
}
.menu ul li{ width:150px;
float:left;
}
.menu label, .menu a{ padding:15px;
display:block;
text-decoration:none;
text-align:center;
background-color:#FFF;
color: #06F;
user-select:none;
transition:all 0.3s linear;
}
.menu ul ul{ position:absolute;
top:50px;
visibility:;
}
.menu ul li:hover ul{ visibility:visible;
}
.menu label:hover, .menu a:hover{ background-color:#CCC;
}
.menu ul ul li{ float:none;
}
.menu ul ul li label, .menu ul ul li a{ border-bottom:1px solid #000;
background-color: #F93;
}
hr#hr1{ position:absolute;
left:149px;
top:-3px;
height:35px;
}
/*sub*/
.sub{ position:fixed;
width:100%;
height:100%;
left:0px;
right:0px;
background-color:#3CF;
display:;
}
#ln1:hover .sub{ display:block;}
<nav class="menu">
<input type="checkbox" class="rd" id="t1"/>
<input type="checkbox" class="rd" id="t2"/>
<ul>
<li id="ln"><label for="t1">News<hr id="hr1"></label></li>
<li id="ln1"><label for="t1">Serviços</label>
<ul>
<div class="sub">
<li><a href="#" id="lk">PRODUTOS-01</a></li>
<li><a href="#" id="lk">PRODUTOS-02</a></li>
</div>
</ul>
</li>
<li id="ln"><label for="t2">Informações</label>
<ul>
<li><a href="javascript:void(0)">Links</a></li>
<li><a href="#">Links</a></li>
</ul>
</li>
</ul>
</nav>
Hugo! I couldn’t clear the line’s Hover effect: . menu label:Hover, . menu a:Hover{ background-color:#CCC;} I did so, . menu a:Hover [id ="Lk"] { all:unset; }
– Elienay Junior
@Elienayjunior this is because of the class priority hierarchy, I edited the answer and put an Important, thus
all: unset !important;
and now cleaned 100%. The rest of the style you want to put has to come after unset ok, likeall: unset !important; color black;
for example– hugocsl
I just figured out another way! . menu #lk1, . menu #lk2 { all:unset; }
– Elienay Junior
@Elienayjunior yes so tb believe it works, but using the [id ="Lk"] you do not need to keep repeating lines of css. However the magic is even on account of the
all:unset
– hugocsl