标签:固定 tran vertica nsf display .com inline containe mod
单行上下左右居中
Html:
<div class=”container”></div>
CSS:
.container{
width: 600px;
height: 300px;
text-align: center;
line-height: 300px;
border: 1px solid green;
}
固定高宽上下左右居中
Html:
<div class=”container”><div class=”content”></div> </div>
CSS:
.container{
border: 1px solid green;
width: 600px;
height: 300px;
position: relative;
}
.content{
background: black;
height: 200px;
width: 200px;
position: absolute;
left: 0;
bottom: 0;
right: 0;
top: 0;
margin: auto;
}
不固定高宽上下左右居中(1)
Html:
<div class=”container”><div class=”content”></div> </div>
CSS:
.container{
border: 1px solid green;
width: 600px;
height: 300px;
line-height: 300px;
text-align: center;
}
.content{
display: inline-block;
line-height: normal;
vertical-align: middle;
resize:both;
overflow: auto;
}
标签:固定 tran vertica nsf display .com inline containe mod
原文地址:http://www.cnblogs.com/ct-5/p/7078532.html