學習DIV+CSS一個最簡單的布局一行三列DIV代碼!

來源:互聯網
上載者:User

CSS代碼如下:

 body{
  text-align:center;
  margin:0px;
  padding:0px;
 
  }
  #father
  {
  position:relative;
  width:750px;
  text-align:center;
  }
   #banner{height:96px;background-color:#999;text-align:left; padding:0px;margin:0px;}
   #b-left{width:159px;margin:0px;padding:0px;float:left;}
   #b-center{margin:0px;float:left;}
   #b-right{
   text-align:left;
   marign:0px;
   padding:0px;
   width:108px;
   background-color:#00ffff;
      height:96px;
   float:right;
}
 HTML代碼如下:

  <div id=banner>
    <div id=b-left> <img src="images/51.gif" /> </div>
    <div id=b-center><img  src="images/tupian26.gif" /></div>
    <div id=b-right>
      <ul style="list-style-type:none;">
        <br />
        <li>設為首頁</li>
        <li>加入收藏</li>
        <li>聯絡我們</li>
      </ul>
    </div>
  </div>

 

現在總結一下:

一行三列的布局有以下幾種 思想:

第一都做成絕對的布局,設定每一個塊和周圍的距離

第二就是利用嵌套的方法,把任意兩個先當成一個,然後再把他們和第三個一起設!不過我這裡好像直接把三個塊都是分開設的,好像也沒有問題!呵呵!

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.