这是一个常见问题,但我仍然没有找到解决办法。
.parent
是一个滑块,而 .child
是图片。
我需要将 .child
的高度(它是一个绝对定位的元素)传递给 .parent
。
.parent
高度为 0px
。有任何想法吗?
提前感谢。
<div class="parent">
<img class="child"></div>
</div>
.child {
position: absolute; //It must be absolute , because slider works with this
width: 100%;
top: 0;
left: 0;
right: 0;
}
<img>
标签,它是相对定位但没有设置visibility
属性?这样可以让隐藏的图片占据空间。 - Chris