美文网首页前端编程
自适应布局 左右结构、上下结构

自适应布局 左右结构、上下结构

作者: Sun____ | 来源:发表于2019-09-30 14:53 被阅读0次

一、左右结构 左边固定,右边自适应

  1. 左边左浮动,右边加个overflow:hidden;
   #lt{ float: left;width:200px; background: #ff0;}

   #rt{ overflow: hidden; background: #f0f;}
  1. 左边左浮动,右边加个margin-left;
   #lt{ float: left; width:200px; background: #ff0;}

   #rt{ margin-left: 200px; background: #f0f;}
  1. 左边绝对定位,右边加个margin-left;
   #lt{ position: absolute; top:0; left:0; width:200px; background: #ff0;}

   #rt{ margin-left: 200px; background: #f0f;}
  1. 左右两边绝对定位,右边加个width,top,left,right
 #lt{ position: absolute; top:0 ; left:0 ;width:200px; background: #ff0;}

 #rt{ position: absolute; top:0 ; left:200px; width: 100% ; rigth:0;background: #f0f;}

二、左右结构 右边固定,左边自适应的布局

  1. 左边左浮动,margin-left负值,右边右浮动;
#lt{float:left; width:100%;background: #00f;margin-right: -200px;}
#rt{float: right; width: 200px;background: #ff0;}
  1. 右边绝对定位,左边margin-right;
   #lt{margin-right:200px; background: #00f;}

   #rt{ position: absolute; right:0; top:0; width: 200px;background: #ff0;}
  1. 左右两边绝对定位,左边加个width,top,left,right
   #lt{ position: absolute; top:0; left:0; rigth:0; width: 100% ; background: #f0f;}

   #rt{ position: absolute; top:0; left:200px; width:200px; background: #ff0;}

三、上下结构自适应

 .header,.footer{
      width: 100%;
      height: 100px;
      line-height: 100px;
      background-color: red;
 }
.content{
       width: 100%;
        position: absolute;
         top: 100px;
         bottom:100px;
          background-color: yellow;
}
.footer{
    position: absolute;
    bottom: 0px;
}

    <div class="header">头部</div>
    <div class="content">内容</div>
    <div class="footer">底部</div>            

相关文章

  • 自适应布局 左右结构、上下结构

    一、左右结构 左边固定,右边自适应 左边左浮动,右边加个overflow:hidden; 左边左浮动,右边加个...

  • 网页设计手法之“左边宽度固定,右边宽度自适应”

    设计场景 左右两列布局,左边宽度固定,右边宽度自适应 老式解决方案 结构 风格 新式解决方案 结构 风格

  • 多列布局方案

    两栏布局 左侧固定右侧自适应 右侧固定左侧自适应 技术原理(左侧固定右侧自适应) 结构上左右两个盒子,左侧设置为固...

  • 移动端布局常用方法

    左右固定,中间自适应(双飞翼或者圣杯布局) 页面结构 1:flex布局,父盒子设置弹性盒,两端固定,中间flex:...

  • js逻辑

    1.html文件介绍 html文件按照左右上下的布局方式进行布局。左侧为树状列表,右侧为上下结构,上方为查询,下方...

  • 三栏布局

    三栏布局,左右两栏宽度固定,中间栏宽度自适应。 假设我们有以下 HTML 结构: 基本样式如下: 本文将介绍几种实...

  • 双飞翼布局--跟着李南江学编程

    双飞翼布局和圣杯布局的结构相同,同样左右两栏固定,中间一栏自适应 前四步和圣杯布局相同 我正在跟着江哥学编程,更多...

  • 网页常用布局方式

    两列布局(左边固定,右边自适应) html结构 1.浮动 inline-block布局 绝对定位 表格布局 弹性盒...

  • 2019-03-16 页面布局

    经典的行布局 行布局固定宽行布局某部位自适应行布局导航随屏幕滚动 上下为0左右居中 margin:0 auto; ...

  • 练字‖5点分析欧阳询《九成宫》单字之“维”

    欧阳询《九成宫》之“维”字分析: 1.“维”字属于左右结构。汉字结构有六种:上下结构,上中下结构,左右结构,左中右...

网友评论

    本文标题:自适应布局 左右结构、上下结构

    本文链接:https://www.haomeiwen.com/subject/yazcpctx.html