父元素没有相对定位也能使自己绝对定位

2015-10-11 0 930
父元素没有相对定位也能使自己绝对定位
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style type="text/css">
      html,body{margin: 0; padding:0;}
        *{padding:0; margin: 0}
        .child{position: absolute; left: 0;top: 0;right: 0; bottom: 0; width: 300px; height: 30px; margin:30px auto; background-color: pink;text-align: center; line-height: 30px;}
    </style>
</head>
<body>
    <div class="father">
      <div class="child">fd</div>
    </div>
</body>
</html>

遇见资源网 html 父元素没有相对定位也能使自己绝对定位 http://www.ox520.com/14454.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务