码迷,mamicode.com
首页 > Web开发 > 详细

相邻兄弟选择器 | Adjacent sibling selectors (Selectors) - CSS 中文开发手册 - Break易站

时间:2020-07-01 23:42:31      阅读:67      评论:0      收藏:0      [点我收藏+]

标签:after   子节点   页面   selectors   ace   graphs   initial   spec   选择   

  • ??CSS 中文开发手册

    相邻兄弟选择器 | Adjacent sibling selectors (Selectors) - CSS 中文开发手册

    相邻兄弟组合因子(+)分隔两个选择器。仅当第二个元素直接跟随第一个元素,且两者都是相同父element的孩子节点时,它匹配该第二个元素。

    /* Paragraphs that come immediately after any image */
    img + p {
      font-style: bold;
    }

    语法

    former_element + target_element { style properties }

    实例

    CSS

    li:first-of-type + li {
      color: red;
    }

    HTML

    <ul>
      <li>One</li>
      <li>Two!</li>
      <li>Three</li>
    </ul>

    结果

    规范

    Specification

    Status

    Comment

    Selectors Level 4The definition of ‘next-sibling combinator‘ in that specification.

    Working Draft

    Renames it the "next-sibling" combinator.

    Selectors Level 3The definition of ‘Adjacent sibling combinator‘ in that specification.

    Recommendation

    ?

    CSS Level 2 (Revision 1)The definition of ‘Adjacent sibling selectors‘ in that specification.

    Recommendation

    Initial definition.

    浏览器兼容性

    Feature

    Chrome

    Edge

    Firefox (Gecko)

    Internet Explorer

    Opera

    Safari

    Basic support

    (Yes)

    (Yes)

    (Yes)

    7.01

    (Yes)

    (Yes)

    Feature

    Android

    Edge

    Firefox Mobile (Gecko)

    IE Mobile

    Opera Mobile

    Safari Mobile

    Basic support

    2.1

    (Yes)

    (Yes)

    ?

    (Yes)

    (Yes)

  • ??CSS 中文开发手册
    转载请保留页面地址:https://www.breakyizhan.com/css/32153.html

    相邻兄弟选择器 | Adjacent sibling selectors (Selectors) - CSS 中文开发手册 - Break易站

    标签:after   子节点   页面   selectors   ace   graphs   initial   spec   选择   

    原文地址:https://www.cnblogs.com/breakyizhan/p/13222232.html

    (0)
    (0)
       
    举报
    评论 一句话评论(0
    登录后才能评论!
    © 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
    迷上了代码!