I have nested ul
and li
. I applied text-decoration: underline;
for the ancestor li
and this style is further carried to descendant li
. In order to remove applied style from descendant li
, I used another text-decoration: none !important;
but It does not work. The selector I used is correct and if I change the text-colour, it works.
My question is: Why the text-decoration: none;
is not working for nested li
(frogs, toads...). I would appreciate the answer with explanation to understand the reason.
ul li {
text-decoration: underline;
}
ul li ul li {
text-decoration: none !important;
/* It is not working */
}
<ul>
<li>Length: 15-20 inches</li>
<li>Peak Breeding Activity: March-April</li>
<li>Typical foods:
<ul>
<li>frogs</li>
<li>toads</li>
<li>salamanders</li>
<li>earthworms</li>
<li>minnows</li>
<li>mice</li>
</ul>
</li>
</ul>