【问题标题】:How can i achieve this layout using css? [Without Grid] [duplicate]如何使用 css 实现这种布局? [无网格] [重复]
【发布时间】:2021-08-22 23:34:19
【问题描述】:

我有以下布局。

当我缩小屏幕尺寸时,蓝色框将转到下一行。但它的位置正好在红色框结束的位置下方。目前,我无法将蓝色框定位到起始位置。我如何在不使用 Grid 的情况下实现这一点 ->

这是我的 html 和 css -

  <div class="order-confirmation">
    <div class="confirmation-body-area">
      <div class="box box-1">Box 1</div>
      <div class="box box-2">Box 2</div>
      <div class="box box-3">Box 3</div>
    </div>
  </div>
.order-confirmation {
    .confirmation-body-area {
      width: 90%;
      margin: auto;
      .box {
        display: inline-block;
      }
      .box-1 {
        background: red;
        height: 214px;
        width: 631px;
        float: left;
      }
      .box-2 {
        background: blue;
        height: 214px;
        width: 427px;
        float: right;
      }
      .box-3 {
        background: yellow;
        height: 214px;
        width: 631px;
        clear: both;
      }
    }
  }

【问题讨论】:

    标签: html css web flexbox responsive-design


    【解决方案1】:

    由于浮动,它与第一个结尾对齐。尝试删除框 1 和框 2 的浮动

    【讨论】:

    • 是的,很简单。当他们交叉时使用媒体查询我可以删除浮动。工作迟到影响。顺便说一句谢谢.... :D
    猜你喜欢
    • 2019-08-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-16
    • 1970-01-01
    • 1970-01-01
    • 2020-01-22
    • 1970-01-01
    相关资源
    最近更新 更多