CSS 选择器 知识点

<html>
<head>
    <style type="text/css">
        h1 > strong { /*子元素选择器 只选择自己 的子元素 子的子不管 */
            color: red;
        }

        h2 strong { /*后代选择器 选择子元素 子的子 */
            color: red;
        }
    </style>
</head>

<body>
    <h1>This is <strong>very</strong> <strong>very</strong> important.</h1>
    <h2>This is <em>really <strong>very</strong></em> important.</h2>
</body>
</html>

猜你喜欢

转载自www.cnblogs.com/kikyoqiang/p/10849898.html