div嵌套浮动居中(完美代码)



div嵌套浮动居中(完美代码)。

<!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=gb2312″ /> <title>无标题文档</title> </head> <style type=”text/css”> body {text-align:center} .clearfix { zoom: 1; } .clearfix:after { content: ” “; display: block; clear: both; } #outer { width: 800px; margin: 0 auto; background-color: #ffffcc; } .inner { width: 180px; height: 130px; margin: 5px; border: 1px solid #0066CC; display: inline-block; } .inner { *display: inline; } </style> </head> <body> <div id=”outer”> <div>1</div> <div>2</div> <div >3</div> <div >4</div> <div >5</div> <div >6</div> <div >7</div> <div >8</div> <div >9</div> <div >10</div> <div >11</div> <div >12</div> <div >13</div> <div >14</div> <div >15</div> <div >16</div> <div >17</div> <div >18</div> <div >19</div> <div >20</div> </div> </body> </html>

 

http://blog.sina.com.cn/s/blog_68d663140100ljkw.html