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

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

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    :before设置width:inherit结果宽度超出父元素宽度
    44
    0

    一个div设置宽度15%,给他加了:before,宽度设置的inherit,但是实际宽度超出了div的宽度
    <div class="aside-left">
    </div>
    <style type="text/css">

       .aside-left{
         width: 15%;
         float: left;
         background-color:blue;
       }
       .aside-left::before{
        content: "";
            width: inherit;
            position: absolute;
            top: 0;
            bottom: 0;
            z-index: -1;
            background-color: inherit;
            border: inherit;
       }
    
    </style>
    浏览器实际显示的.aside-left宽度为285.59,:before的宽度为288,这是为什么呢
    0
    打赏
    收藏
    点击回答
        全部回答
    • 共 0 条
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部