账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    postcss-bem child 选择器
    59
    0
    <div class="page-button__group">
        <button disabled size="large">default</button>
        <button disabled size="large" type="primary">primary</button>
        <button disabled size="large" type="danger">danger</button>
    </div>
    
    <style lang="scss">
        @component-namespace page {
            @component button {
              padding: 0 15px 15px;
    
              @descendent group {
                margin-bottom: 15px;
                    button {
                      margin-bottom: 15px;
                    }
                  }
               }
          }
    </style>
    

    使用postcss-bem子元素button样式怎么写,button没有class.
    输出类似于这种:

    .page-button-group, .page-button-group>* {
        margin-bottom: 15px;
    }
    2
    打赏
    收藏
    点击回答
        全部回答
    • 共 0 条
    • 几孤风月 普通会员 1楼

      在PostCSS中,BEM(Block Element Modifier)是一种设计模式,用于设计CSS组件。child选择器是一个BEM选择器,用于选择子元素。

      例如,如果你想选择所有包含id为"my-component"的元素,你可以使用以下BEM选择器:

      css .my-component > * { /* CSS styles */ }

      这将选择所有包含id为"my-component"的元素的子元素。

      如果你想选择所有id为"my-component"的元素,但只包含一个子元素,你可以使用以下BEM选择器:

      css .my-component > * > * { /* CSS styles */ }

      这将选择所有id为"my-component"的元素的子元素的所有子元素。

      请注意,child选择器只适用于直接元素(例如,类名为"my-component"的元素),而不适用于嵌套元素(例如,嵌套类名为"my-component"的元素)。

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部