• Web设计之网页布局CSS技巧


    http://www.cnblogs.com/sosoft/p/3509977.html

    1、两列布局 

    1.1、左列固定,右列自适应 
    #left{    190px; float:left; } 
    #right{    margin-left:205px; } 

    1.2、右列固定,左列自适应 
    #left{    float:left; 100%; } 
    #right{    float:left; margin-left:-100px; 100px; } 

    2、三列布局 

    2.1、左右宽度固定,中间自适应 
    #left{ float:left; 200px; } 
    #middle{ margin:0 210px; } 
    #right{ float:right; 200px; } 



    2.2、中间宽度固定,左右自适应 

    这个有点复杂,有必要先贴html 

    <div class="wrap"> 
      <div class="left"> 
      <div class="leftWrap">left左列</div> 
      </div> 
      <div class="right"> 
        <div class="rightWrap">right右列 http://www.cnblogs.com/sosoft/</div> 
      </div> 
      <div class="center">Center</div> 
    </div> 

    css样式: 

    .wrap{position:relative;overflow:hidden;100%} 
    .left{float:left;50%;margin-left:-400px;padding-left:200px; } 
    .leftWrap{margin-left:200px;background:#aaa;} 
    .right{float:right;50%;margin-right:-400px;padding-right:200px;} 
    .rightWrap{margin-right:200px;background:#aaa;} 
    .center{position:absolute;left:50%;margin-left:-200px;400px;background:#eee;} 

    3、上中下三行布局 


    html { height:100%; } 
    body { height:100%; } 

    /*如需满屏,则对html和body都设置height:100%*/ 

    #top { position:absolute; left:10px;top:0px;right:10px;height:50px;} 
    #main { position:absolute; left:10px;top:60px;bottom:60px;right:10px;overflow:auto;} 
    #bottom { position:absolute; left:10px; bottom:0px; right:10px; height:50px;}xi 

    /*IE6下*/ 

    #top { *height:50px; *margin-top:-60px; *margin-bottom:10px; *position:relative; *top:0; *right:0; *bottom:0; *left:0;} 
    #main { *height:100%; *margin-left:210px; _margin-left:207px; *position:relative; *top:0; *right:0; *bottom:0; *left:0;} 
    #bottom { *height:50px; *margin-top:10px; *position:relative; *top:0; *right:0; *bottom:0; *left:0;}

  • 相关阅读:
    90个常用词根,30个前缀30个后缀
    七、图形与图像处理(1)
    解决Android SDK下载和更新失败的方法(Win系统) 和离线安装
    IT技术网站汇总
    css padding和margin的百分比
    div无法跟随内容的增加而拉伸
    html元素被隐藏在后面
    cron 执行php文件
    cron 编辑器修改
    Eclipse PHP 代码无法自动提示函数
  • 原文地址:https://www.cnblogs.com/lixiangyong/p/4802911.html
Copyright © 2020-2023  润新知