【问题标题】:HTML bar should cross all divsHTML 栏应该跨越所有 div
【发布时间】:2017-04-10 19:52:51
【问题描述】:

我对 html 或 css 或两者都有问题。我正在寻找一种可能性来创建一个跨越所有 div 的栏。上图展示了我的项目。

我想在 css 中完成,而不是放置单独的图片。这可能吗?

谢谢。

【问题讨论】:

  • 你应该谷歌“css绝对定位”

标签: html css htmlbars


【解决方案1】:

查看CSS position property

.child {
  height: 100px;
  background-color: blue;
  margin: 5px 0;
  border-radius: 8px;
}

.container {
  position: relative;
}

.left-bar {
  position: absolute;
  background-color: red;
  height: 100%;
  width: 20%;
  border-radius: 8px;
}
<div class="container">
  <div class="left-bar">
  </div>
  
  <div class="child">
  </div>
  
  <div class="child">
  </div>
  
  <div class="child">
  </div>
</div>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-17
    • 2013-11-01
    • 2019-06-23
    • 2014-04-09
    • 1970-01-01
    • 2012-12-15
    • 1970-01-01
    • 2018-07-15
    相关资源
    最近更新 更多