CSS:Cascading Style Sheet (层叠样式表)
CSS的内容可以分开写入CSS文件中,PHP文件中加入以下语句即可:
<link herf="css/style.css" type="text/css" rel="stylesheet"/>
其中,style.css写入定义的样式,如:
ul.menu{
list-style-type:none;
background:#59d3cc;
height:64px;
font-size:24px;
}
使DIV居中:
div#header{margin-left: auto;margin-right: auto;}
子元素使用了浮动,则需要清除最外层浮动
如子元素:
ul#navigation li{
float:left;
width:170px;
text-align:center;
position:relative;
padding:7px 5px 7px 5px;
}
则最外层navigation:
<!--PHP file--><div id="navigation" class="clearfix"> ... </div>
<!--CSS file-->
.clear{clear:both}
.clearfix:after{content: "."; display: block; height: 0; clear: both; visibility: hidden;}
.clearfix{zoom:1}