美文网首页
两栏布局之将右边的dom放在前面

两栏布局之将右边的dom放在前面

作者: 六寸光阴丶 | 来源:发表于2020-10-17 17:40 被阅读0次
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta
    name="viewport"
    content="width=device-width, initial-scale=1.0"
  >
  <title>Document</title>
  <style>
    .margin-bottom {
      margin-bottom: 10px;
    }

    .container1 {
      position: relative;
    }

    .left1 {
      background-color: green;
      height: 200px;
      width: 200px;
      position: absolute;
      left: 0;
      top: 0;
    }

    .right1 {
      background-color: yellow;
      height: 200px;
      margin-left: 200px;
    }

    .container2 {
      display: flex;
      flex-direction: row-reverse;
    }

    .left2 {
      background-color: green;
      height: 200px;
      width: 200px;
    }

    .right2 {
      background-color: yellow;
      height: 200px;
      flex: 1;
    }

    .container3 {
      padding-left: 200px;
    }

    .left3 {
      background-color: green;
      height: 200px;
      width: 200px;
      float: left;
      margin-left: -100%;
      position: relative;
      left: -200px;
    }

    .right3 {
      background-color: yellow;
      height: 200px;
      width: 100%;
      float: left;
    }
  </style>
</head>

<body>
  <div class="container1 margin-bottom">
    <div class="right1">right</div>
    <div class="left1">left</div>
  </div>
  <div class="container2 margin-bottom">
    <div class="right2">right</div>
    <div class="left2">left</div>
  </div>
  <div class="container3">
    <div class="right3">right</div>
    <div class="left3">left</div>
  </div>
</body>

</html>
image.png

相关文章

  • 两栏布局之将右边的dom放在前面

  • 我还是要说的布局

    两栏布局 左边固定右边自适应 使用float布局 使用position布局    三栏布局 左右两边固定中间自适应...

  • 圣杯布局

    圣杯(grail)布局实现的是三栏布局,两边的盒子宽度固定,中间盒子自适应的布局。中间栏要在放在文档流前面以优先渲...

  • CSS

    圣杯布局、双飞翼布局 这两种布局都是两侧固定,中间自适应。中间栏要在放在文档流前面以优先渲染

  • 圣杯布局与双飞翼布局的区别

    目的: 圣杯布局和双飞翼布局解决的问题是相同的,就是两边顶宽,中间自适应的三栏布局,中间栏要在放在文档流前面以优先...

  • 两栏布局

    两栏布局 左边固定,右边自适应的两栏布局 首先创建基本的HTML布局和最基本的样式。 左边固定宽度,高度不固定 基...

  • 圣杯布局和双飞翼布局的理解和区别

    作用: 两种布局用于解决的问题是一样的:两边顶宽 中间自适应的三栏布局 中间栏要放在文档前面以优先渲染 区别:...

  • 圣杯布局和双飞翼布局的理解和区别

    一、作用 圣杯布局和双飞翼布局解决的问题是相同的,就是两边顶宽,中间自适应的三栏布局,中间栏要在放在文档流前面以优...

  • 百度前端学院task3笔记

    实现三栏式布局(左右两栏定宽,中间宽度自适应)有多种方法最合适的是 将左边栏与右边栏的css的float属性分别设...

  • 双飞翼布局

    双飞翼布局和圣杯布局的目的是一样,就是两边顶宽,中间自适应的三栏布局,中间栏要在放在文档流前面以优先渲染。 圣杯布...

网友评论

      本文标题:两栏布局之将右边的dom放在前面

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