<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> <html xmlns=”http://www.w3.org/1999/xhtml”> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ /> <title>使用UL进行多列布局</title> <style type=”text/css”> * {margin:0; padding:0;} body { width:100%; height:100%; background:#ddedfb; } #mainContent { width:600px; margin:10px auto; } #header,#footer { background:#8AC7FA; height:80px; clear:both; } #footer { clear:both; padding-top:10px; } #content { height:300px; margin:10px auto; } #content ul { list-style:none; height:100%; } #content ul li { width:150px; height:100%; background:#8AC7FA; float:left; } #content ul li#li2 { width:280px; margin:0 10px; } #content ul li#li2 ul li { width:270px; height:140px; margin:5px; background:#0581F0; } </style> </head>
<body> <div id=”mainContent”> <div id=”header”>这是头部</div> <div id=”content”> <ul> <li>这是左边</li> <li id=”li2″> <ul> <li>这是中间的上部</li> <li>这是中间的下部</li> </ul> </li> <li>这是右边</li> </ul> </div> <div id=”footer”>这是底部</div> </div> </body> </html>
|