css等比例矩形

2019-09-26  本文已影响0人  w_wx_x
<style type="text/css">
    .box{
        width: 500px;
    }
    .container{
        width: 100%;
        padding-bottom: 50%;
        position: relative;
    }
    .content{
        width: 100%;
        height: 100%;
        position: absolute;
        background-color: red;
    }
</style>
</head>

<body>
<div class="box">
    <div class="container">
        <div class="content">122aaaaa22</div>
    </div>
</div>
</body>
image.png
image.png
上一篇 下一篇

猜你喜欢

热点阅读