通过css实现div的居中
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
3 <head profile="http://gmpg.org/xfn/11">
4 </head>
5 <body>
6 <div style=" position:relative; margin-left:auto; margin-right:auto; width:786px; background-color:Purple;">
7 <div style="width:500px; float:right">内容</div>
8 <div style="background-color:Yellow; width:200px">侧栏上</div>
9 <div style="background-color:Blue; width:200px">侧栏下</div>
10 </div>
11 </body>
12 </html>
2 <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
3 <head profile="http://gmpg.org/xfn/11">
4 </head>
5 <body>
6 <div style=" position:relative; margin-left:auto; margin-right:auto; width:786px; background-color:Purple;">
7 <div style="width:500px; float:right">内容</div>
8 <div style="background-color:Yellow; width:200px">侧栏上</div>
9 <div style="background-color:Blue; width:200px">侧栏下</div>
10 </div>
11 </body>
12 </html>