如何覆盖父元素的 text-decoration-line?

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .father {
            color: red;
            text-decoration-line: line-through;
        }

        .son {
            color: blue;
            background-color: yellow;
            text-decoration-line: none;
        }
    </style>
</head>

<body>
    <span class="father">father
        <span class="son">
            son
        </span>
    </span>

</body>

</html>

出来的结果是这样的:
image.png

请问如何让 .son 部分没有删除线呢,就像这样:
image.png

update:
知道了,给 .son 设为 inline-block 就可以了!

阅读 1.1k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题