我从http://getbootstrap.com/javascript/#carousel一直在研究bootstrap carousel
具有 carousel-control
类的左侧和右侧尖括号控件是 anchor 标记。这些 anchor 标记的容器高度为 100%。这些也是相对于容器 div 绝对定位的。我的问题是:
- 为什么 position absolute 给 anchor 标签(内联元素)100% 的容器高度?
最佳答案
绝对位置 blockifies 元素,但除非明确说明,否则不会使它们成为父元素的 100% 高度。
在这种情况下,它在 CSS 中说明
.carousel-control {
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 15%;
font-size: 20px;
color: #fff;
text-align: center;
text-shadow: 0 1px 2px rgba(0,0,0,.6);
background-color: rgba(0,0,0,0);
filter: alpha(opacity=50);
opacity: .5;
}
基本上
top: 0;
bottom: 0;
本质上与 height:100%
相同。
关于html - 为什么绝对位置给 anchor 标签 100% 的容器高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40401229/