</ul>
<!– 豎直居中–>
<!– 1.設置相同的上下padding –>
<!– 2.父元素height和line-height相同 –>
<hr />
<div style={background:#000;width:500px;color:#fff;line-height:100px;text-align:center}>
我要來場說走就走的旅行
</div>
<!–3. vartical-align,這屬性只對tr,td起作用 –>
<table>
<tr verticla-align=”center” height=”100″ background=”#FF00FF”>
<td>一弦一柱思華年</td>
</tr>
</table>
css样式
复制代码
<style type=”text/css”>
.father
{
width:500px;
}
.inlineCenter
{
text-align:center;
float:left;
}
.blockCenter
{
width:100px;
margin-left:auto;
margin-right:auto;
text-align:”center”
}
.tableclass
{
margin-left:auto;
margin-right:auto;
}
.ulclass
{
list-style:none;
margin:0;
padding:0;
}
.ulclass li
{
float:left;
display:inline;
text-align:center;
}
.ulclass li a
{
text-align:center;
float:left;
background:#316AC5;
color:#fff;
}
.ulclass li a:hover
{
background:#fff;
color:#316AC5;
}
.relativeCenterFather
{
float:left;
position:relative;
left:50%
}
.relativeCenterChild
{
float:left;
position:relative;
left:-50%;
}
/* 豎直居中*/
.wrap
{
background:#000;
width:500px;
color:#fff;
height:100px;
line-height:100px;
}
</style>
以上就是本文所述的全部内容了,希望对大家熟练掌握CSS能够有所帮助。










