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

浮动元素垂直居中,bootstrap栅格布局垂直居中

时间:2017-10-16 16:53:05      阅读:271      评论:0      收藏:0      [点我收藏+]

标签:nbsp   nsf   top   type   das   title   垂直居中   head   lan   

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>子元素在父元素里面垂直居中</title>
<link rel="stylesheet" type="text/css" href=""/>
<style>
    #d1{
        position: relative;
        border:thin solid red;
        width:900px;
        height:100px;
    }
    #d2{/*dashed也是虚线*/
        border:thin dotted blue;
        width:50px;
        height:50px;
        float:right;  
    }
    .center-vertical{
        position: relative;
        top: 50%;
        transform: translateY(-50%);
    } 
</style>  
</head>
<body>
<div id="d1">
    <div id="d2" class="center-vertical"></div>
</div>
</body>  
</html>

 

浮动元素垂直居中,bootstrap栅格布局垂直居中

标签:nbsp   nsf   top   type   das   title   垂直居中   head   lan   

原文地址:http://www.cnblogs.com/supe/p/7676880.html

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