html简单布局

1.div布局
[html] view plain copy

    <!DOCTYPE html>  
    <html>  
    <head lang="en">  
        <meta charset="utf-8">  
        <title></title>  
        <style>  
            body{margin: 0; padding: 0;}  
            #header{width:100%; height: 90px; background: #b19f9d; }  
            #nav{margin: 0 auto; width:70%; height: 90px; background: #fcf;}  
            .content{width: 950px; height: 900px; background: #847369; margin: 0 auto;}  
            .left{width:30%; height: 900px; background: #decfd4; float: left;}  
            .right{width: 70%; height: 900px; background: #b3a19d; float: left;}  
            footer{width:100%; height: 150px; background: #a8817a;}  
        </style>  
    </head>  
      
    <body>  
        <header id="header">  
            <nav id="nav">空空</nav>  
        </header>  
        <div class="content">  
            <div class="left"></div>  
            <div class="right"></div>  
        </div>  
        <footer></footer>  
    </body>  
      
      
    </html>  

2.table布局
[html] view plain copy

    <!DOCTYPE html>  
    <html>  
    <head lang="en">  
        <meta charset="utf-8">  
        <title></title>  
        <style>  
              
        </style>  
    </head>  
      
    <body marginheight="0px" marginwidth="0px">  
        <table width="100%" height="950px" style="background-color:gray">  
            <tr>  
                <td colspan="2" width="100%" height="10%" style="background-color: aqua" ><td>  
            </tr>  
            <tr>  
                <td  width="20%" height="80%" style="background-color: blue" ><td>  
                <td  width="80%" height="80%" style="background-color: blue" ><td>  
            </tr>  
            <tr>  
                <td colspan="2" width="100%" height="10%" style="background-color: black" ><td>  
            </tr>  
          
        </table>  
    </body>  
      
      
    </html>  

[html] view plain copy

    <!DOCTYPE html>    
    <html>    
    <head lang="en">    
        <meta charset="utf-8">    
        <title></title>    
        <style>    
            body{  
            <span style="white-space:pre;"> </span>margin: 0 auto;  
            }  
            table{  
            <span style="white-space:pre;"> </span>width: 100%;  
            <span style="white-space:pre;"> </span>height: 950px;  
            <span style="white-space:pre;"> </span>background: gray;  
            <span style="white-space:pre;"> </span>}  
    <span style="white-space:pre;">     </span>#header{  
    <span style="white-space:pre;">         </span>width: 100%;  
    <span style="white-space:pre;">         </span>height: 10%;  
    <span style="white-space:pre;">         </span>background: aqua;  
    <span style="white-space:pre;">         </span>}  
    <span style="white-space:pre;">     </span>#content{  
    <span style="white-space:pre;">         </span>width: 100%;  
    <span style="white-space:pre;">         </span>height: 80%;  
    <span style="white-space:pre;">         </span>background: blue;  
    <span style="white-space:pre;">     </span>}/**如果这里的父元素定了高度,子元素就不要定高度,然后table标签的属性在样式里面是不通用**/  
    <span style="white-space:pre;">     </span>.content_left{  
    <span style="white-space:pre;">         </span>width: 30%;  
    <span style="white-space:pre;">         </span>background: #f60;  
    <span style="white-space:pre;">     </span>}  
    <span style="white-space:pre;">     </span>.content_right{  
    <span style="white-space:pre;">         </span>width: 70%;  
    <span style="white-space:pre;">         </span>background: #fcc;  
    <span style="white-space:pre;">     </span>}  
    <span style="white-space:pre;">     </span>#footer{  
    <span style="white-space:pre;">         </span>width: 100%;  
    <span style="white-space:pre;">         </span>height: 10%;  
    <span style="white-space:pre;">         </span>background: aqua;  
    <span style="white-space:pre;">     </span>}  
        </style>    
    </head>    
        
    <body>    
        <table  cellspacing="0" cellpadding="0" border="0">    
            <tr id="header">    
                <td colspan="2"><td>    
            </tr>  
            <tr id="content">    
                <td class="content_left"><td>    
                <td class="content_right"><td>    
            </tr>  
            <tr id="footer">    
                <td colspan="2"><td>    
            </tr>    
        </table>    
    </body>    
        
        
    </html>   

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值