:160px; margin-left:-460px; } </pre> </div> </div> <div id="footer">footer <br/><a href="http://www.dudo.org/" style="color:#000;text-decoration:none;">http://www.dudo.org/</a> </div> </div> </body> </html>
代码2(自己查看运行效果)
<!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> <title> div+css布局中的结构和表现分离 </title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <style type="text/css"> body { font-size:middle;font-family:Tahoma,Arial, Helvetica, sans-serif,"雅黑","宋体"; background-color:#999;} div { background-color:#ccc; } #wrap { width:760px; padding:10px; margin:0 auto; background-color:#fff; } #header { height:100px; } #content { height:300px; margin-top:10px; background-color:#fff; } #primaryContent { float:left; height:300px; width:290px; } #secondaryContent { float:left; height:300px; width:290px; margin-left:10px; } #sideContent { float:left; height:300px; width:160px; margin-left:10px; } #footer { height:100px; margin-top:10px; } pre { font-family:tahoma; } </style> </head> <body> <div id="wrap"> <div id="header">header </div> <div id="content"> <div |