本文介绍了在绝对div上设置高度100%的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我遇到了覆盖100%高度div 的问题。我可以使用位置固定解决封面,但这不是我真正想要的,因为你应该能够向下滚动覆盖>所以分辨率低于我的人可以看到整个内容。
I am facing a problem with overlaying a 100% height div. I could use position fixed to solve the cover, but that's not really what I want because you should be able to scroll down on the 'cover' > so people with lower resolutions than mine can see the entire content.
代码示例:
HTML
<body> <div>Overlay example text</div> </body>CSS
body { float: left; height: 3000px; width: 100%; } body div { position: absolute; height: 100%; width: 100%; background-color: yellow; }问题:包含100%的webbrowser / viewport,但我想要覆盖整个身体。
The problem: The div's height 100% only contains 100% of the webbrowser/viewport, but I want it to cover the entire body.
提前感谢:)
推荐答案jsbin/ubalax/1 / edit 。您可以在此处看到结果
jsbin/ubalax/1/edit .You can see the results here
body { position: relative; float: left; height: 3000px; width: 100%; } body div { position: absolute; height: 100%; width: 100%; top:0; left:0; background-color: yellow; }更多推荐
在绝对div上设置高度100%
发布评论