DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> CSS入門知識 >> CSS詳解 >> CSS代碼:如何實現讓多個DIV排列時居中
CSS代碼:如何實現讓多個DIV排列時居中
編輯:CSS詳解     

<?XML version="1.0" encoding="iso-8859-1"?>
<!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>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/Html; charset=iso-8859-1" />
<style type="text/CSS">
body {text-align:center}
#outer {
 width:60%;
 background:#ffffcc;
 margin:auto;
 text-align:center;
}
.inner {
 width:100px;
 height:100px;
 margin:5px;
 border:1px solid #000;
}
* Html .inner {display:inline}/* for IE*/
Html>body #outer {display:table}/*for mozilla */
Html>body .inner {display:table;float:left}/*for mozilla */
@media all and (min-width: 0px){/* Opera 7 styles */
Html>body .inner {display:inline-block;float:none;}
}

</style>
</head>
<body>
<!-- force quirks mode by using the XML pro-logue -->
<div id="outer">
  <div class="inner">test</div>
  <div class="inner">2</div>
  <div class="inner">3</div>
  <div class="inner">4</div>
  <div class="inner">5</div>
  <div class="inner">6</div>
  <div class="inner">7</div>
  <div class="inner">8</div>
  <div class="inner">9</div>
  <div class="inner">10</div>
  <div class="inner">11</div>
  <div class="inner">12</div>
  <div class="inner">13</div>
  <br style="clear:both" />
</div>
</body>
</Html>

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved