padding百分百值是相对谁的百分比

先看代码

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        .outer {
            width: 300px;
            height: 600px;
            background: #888;
        }
        .b169 {
            width: 100%;
            height: 0;
            padding-bottom: 56.2%;
            position: relative;
        }
        .b169 > .innerb169 {
            width: 100%;
            height: 100%;
            background-color: red;
            position: absolute;
        }
    </style>
</head>
<body>
    <script type="text/javascript">

        

    </script>
    
    <div class="outer">
        <div class="b169">
            <div class="innerb169">hello</div>
        </div>
    </div>
</body>

要查一下资料了。规定基于父元素的宽度的百分比的内边距。

原文地址:https://www.cnblogs.com/zhansu/p/10314388.html