我想覆蓋子元素中的父css。 我想強調父元素,但不是子元素。覆蓋子元素上的文本修飾
.parent {
text-decoration: underline;
color: red;
}
.child {
color: green;
text-decoration: none !important;
}
.sub-child {
color: green;
text-decoration: none !important;
}
<div class="parent">Inside parent
<div class="child">Inside first child
<div class="sub-child">Inside 1st child of 1st child
</div>
</div>
<div class="child">Inside 2nd child
<div class="sub-child">Inside 1st child of 2nd child</div>
<div class="sub-child">Inside 2nd child of 2nd child</div>
</div>
<div class="child">
Inside 3rd child
<div class="sub-child">Insde 1st child of 3rd child</div>
</div>
</div>
請澄清您的具體問題或添加其他詳細信息以突出顯示您的需要。正如目前所寫,很難確切地說出你在問什麼。 –