【问题标题】:2 divs on the left and the right of the wrapper, and to the infinity包装器左侧和右侧的 2 个 div,以及无穷大
【发布时间】:2014-11-15 17:52:18
【问题描述】:

我有一个 1024 像素宽度的包装器。我需要两个 div;

一个在包装器的左侧,另一个在右侧,但重要的是我希望 div 左右无限。

【问题讨论】:

    标签: html wrapper infinite


    【解决方案1】:

    从每个 50% 的宽度开始,然后从中减去一半的容器宽度。并定位它们

    .left, .right{
      position: absolute;
      width: calc(50% - 512px);
    }
    
    .left{
      left: 0;
    }
    
    .right{
      right: 0;
    }
    

    如果这是出于样式目的,那么使用伪元素是个好主意。 Here's a fiddle example.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-03
      • 1970-01-01
      • 1970-01-01
      • 2018-07-03
      • 2019-03-08
      • 2015-06-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多