translate+position实现居中

来源:互联网 发布:mysql change column 编辑:程序博客网 时间:2024/05/16 02:32
<!DOCTYPE html><html lang="en">    <head>        <meta charset="utf-8">        <style type="text/css">            *{                padding:0;                margin:0;            }            .f{                width:500px;                height:300px;                background:red;                margin: 50px auto;                position:relative;            }            .s{                width:200px;                height:100px;                background:yellow;                position:absolute;                transform: translate(75%, 100%);            }        </style>    </head>    <body>        <div class="f">            <div class="s"></div>        </div>    </body></html>

原创粉丝点击