由CSS控制的自由布局

來源:互聯網
上載者:User
<html>
  <head>
    <title>freelayout.html</title>
 <style type="text/css">
 *{
  margin:0;
  padding:0;
 }
 body{
  text-align:center;
  padding:10px;
 }
 #wrapper{
  width:100%;
  margin:0 auto;
  text-align:left;
  background:#efefef url(image/fside.jpg) repeat-y 70% 0;
 }
 #header{
  height:120px;
  background-color:#26efef;
 }
 #main{/*注意這裡,因為使用多加一層視窗的方式,這個元素暫時已經沒有作用了*/}
 #content{
  float:left;
  width:70%;
  background-color:#efef9a;/*為了更容易看出問題,我給添加了背景*/
 }
 #sidebar{
  float:right;
  width:30%;
  background-color:#8faebe;
 }
 #footer{
  clear:left;
  height:80px;
  background-color:#688b9a;
 }
 #innerHeader,#innerContent,#innerSidebar,#innerFooter{
  padding:10px;
 }
 
 </style>
  </head>
 
  <body>    <div id="wrapper">
     <div id="header">
      <div id="innerHeader">頁頭部分</div>
     </div>
     <div id="main">
      <div id="content">
       <div id="innerContent">主體的內容部分</div>
      </div>
      <div id="sidebar">
       <div id="innerSidebar">主體的側欄部分</div>
      </div>
     </div>
     <div id="footer">
      <div id="innerFooter">頁底部分 </div>
     </div>
    </div>
  </body>
</html>
相關文章

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.