- 所属分类:网站建设知识
- 作者: 利来w66(中国)有限公司
- 更新时间: 2015-1-23 15:17:46
- 返回列表
方法1 、line-height:
<style>
.content {
height:240px;
line-height: 240px;
}
</style>
<div class="content">
深圳网站建设-利来w66(中国)有限公司
</div>
方法2 、:before:
<style>
.content {
height: 240px;
}
.child:before {
content: ' ';
display: block;
height: 120px;
}
</style>
<div class="content">
<div class="child">
深圳网站建设-利来w66(中国)有限公司
</div>
</div>
方法3 、padding-top:
<style>
.content {
height:240px;
}
.child {
padding-top: 120px;
}
</style>
<div class="content">
<div class="child">
深圳网站建设-利来w66(中国)有限公司
</div>
</div>
方法4、 position:absolute:
<style>
.content {
position:absolute;
height:240px;
}
.child {
position: relative;
top:50%;
}
</style>
<div class="content">
<div class="child">
深圳网站建设-利来w66(中国)有限公司
</div>
</div>
方法5、display:table-cell;
<style>
#content {
display:table;
}
#child {
display:table-cell;
vertical-align:middle;
height: 300px;
}
</style>
<div id="content">
<div id="child">
深圳网站建设-利来w66(中国)有限公司
</div>
</div>