我在页面左侧的按钮中有一个通知元素,通知从底部弹出
#alert-wrap {
position: fixed;
bottom: 0;
left: 0;
height: 300px; // <--- THIS IS THE PROBLEM
overflow: hidden;
z-index : 100000;
width : 100%;
#alert-container {
position : absolute;
bottom : 0;
left: 0;
width : 100%;
}
}
HTML,这里的简单内容
<div id="alert-wrap">
<div id="alert-container"></div>
</div>
显示器可以工作,但是因为高度设置为300,所以它与内容重叠并且阻止用户单击内容。
无论如何,是否需要max-height
在此外部元素上设置a以仅占用内部通知所需的空间?
我玩了,但它总是消失了。
这是您的解决方案
#alert-wrap {
position: fixed;
bottom: 0;
left: 0;
max-height: 300px; /* max height */
overflow: hidden; /* hide overflow */
z-index : 100000;
width : 100%;
}
#alert-container {
/* Nothing, keep it in the flow ! Or use relative position */
}
另外,永远不要将一个id选择器包装在另一个选择器中。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句