css element+element 选择器.html

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>css element+element 选择器</title>
    <style>
        /*参考:https://www.w3school.com.cn/cssref/selector_element_plus.asp
        知识点:
        element+element 选择器用于选取第一个指定的元素之后(不是内部)紧跟的元素。
        */
        div + p {
            background-color: yellow;
        }
    </style>
</head>
<body>
<h1>欢迎来到我到的主页</h1>
<div>
    <p>我是唐老鸭。</p>
    <p>我住在 Duckburg。</p>
</div>
<p>我最好的朋友是米老鼠。</p>
<p>我的样式不会改变。</p>
</body>
</html>





发布了198 篇原创文章 · 获赞 58 · 访问量 8万+

猜你喜欢

转载自blog.csdn.net/weixin_42193179/article/details/103686352
今日推荐