我不明白为什么text-decoration: none
在下面的代码中不起作用。它不能删除yes
这个词的下划线。css“text-decoration:none”不起作用
.button {
color: black;
text-decoration: none;
}
body {
font-family: 'Roboto', 'Microsoft JhengHei', sans-serif;
font-size: 24px;
}
<a href="www.example.com">
<div class="button" id="yes">
Yes
</div>
</a>
正如你可以从下面的例子中看到,孩子可以覆盖父。这与上面的问题矛盾。
.b {
color: black;
}
.c {
color: yellow;
}
<div class="b">
<div class="c">
abc
</div>
</div>
@BhojendraNepal的OP已修订的问题。他的问题还没有解决。 – Pingu
您不是覆盖颜色,而是文字修饰,它不会从父元素继承。 –
但是,如果文字修饰不能被继承,为什么'yes'被加下划线? –