如何去除子元素从父元素“继承”的下划线
问题描述
text-decoration
有着自己不同寻常的一面。
在 CSS 文档中,我们发现,text-decoration
属性不可被继承。
当时,在视觉上,我们惊讶地发现似乎可以继承!实例代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
p.quirk {
text-decoration: underline;
color: black;
}
strong {
color: green;
}
</style>
</head>
<body>