html - 修复了多个不重叠的 div 标签

标签 html css css-position

我有以下代码块:

<div class="fixme">Fixed 1</div>
<div class="fixme">Fixed 2</div>
<div class="fixme">Fixed 3</div>
<div class="fixme">Fixed 4</div>

和CSS:

.fixme {
  position: fixed;
  right: 0; 
  bottom: 0; 
  width: 24%; 
  text-align: center; 
  padding: 2%; 
  z-index: 1;
  background-color:red;
}

我想要每个 block 如下:

enter image description here

但结果,我的 block 是重叠的,没有按照我的意愿分开

http://jsfiddle.net/uacqjs91/

最佳答案

只需包装您的标签 div,并将位置 css 添加到包装器

.wrapper {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 24%;
  z-index: 1;
}

.fixme {
  text-align: center;
  padding: 2%;
  margin-bottom: .5rem;
  background-color: red;
}

.fixme:last-child {
  margin-bottom: 0;
}
<div class="wrapper">
  <div class="fixme">Fixed 1</div>
  <div class="fixme">Fixed 2</div>
  <div class="fixme">Fixed 3</div>
  <div class="fixme">Fixed 4</div>
</div>

关于html - 修复了多个不重叠的 div 标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53237273/

相关文章:

html - GridView 中的单选按钮

html - div 宽度 100% +10px : relative to parent?

jquery - 如何通过 jQuery 绝对定位元素?

html - 绝对位置和溢出 :auto without a scroll bar appearing

javascript - 使用 JQuery/CSS 动画增加 div 的大小

javascript - Bootstrap 如何在同一窗口中显示所选图像(来自 img src ="")?

javascript - 悬停时部分填充对象

javascript - 图像仅在提供可选的 html 参数时不显示(否则显示)

html - 如何停止和恢复 HTML5 中的实时音频流而不是暂停它?

HTML 选择菜单下拉菜单 : from right to left