在版面中處理水平置中,使用 margin:0 auto; 就可以完成
垂直置中最簡單的方法,用行高來處理,line-height
html
垂直置中最簡單的方法,用行高來處理,line-height
html
<div id=”a”>
<div id=”b”></div>
</div>
css
#a{
margin: 0 auto;
width:300px;
height:200px;
border:1px solid #000;
line-height:200px;
text-align:center;
}
#b{
display:inline-block;
width:30px;
height:30px;
background:green;
}
转载请注明:XAMPP中文组官网 » 垂直置中