码迷,mamicode.com
首页 > 其他好文 > 详细

实现子元素在父元素里面左右上下居中

时间:2020-05-02 15:01:04      阅读:65      评论:0      收藏:0      [点我收藏+]

标签:pos   技术   idt   alt   bsp   ati   abs   居中   margin   

 利用定位:让子元素在父元素里面左右上下居中?前提要在父元素上加上position:relative形成参照物
         /* 左右上下的居中 */
        position:absolute;
        left:0;right:0;
        top:0;bottom:0;
        margin:auto;
技术图片

 

技术图片

 

 

 

实现子元素在父元素里面左右上下居中

标签:pos   技术   idt   alt   bsp   ati   abs   居中   margin   

原文地址:https://www.cnblogs.com/yysn/p/12817804.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!