大佬教程收集整理的这篇文章主要介绍了html – 100%高度div,由于margin-top 50px,滚动条50px关闭屏幕.溢出自动,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我目前的做法是div宽度100%;身高50px;绝对的位置;前0;左0;然后是第二个高度为100%的div;宽度100%; margin-top 50px;溢出:汽车;但是,出现的滚动条会被50px的边距所抵消,因此会将内容从页面底部推出.如果我删除边距它一切正常但它将内容放在导航栏后面.
我也尝试将它包装在一个容器中进行试验,将边缘和溢出物放在孩子身上,但这似乎仍然没有达到要求的效果.
jsFiddle,有评论尝试更好地解释它.
http://jsfiddle.net/Piercy/hggXJ/
HTML
<div id="nav"> <h1>Navigation</h1> </div> <!-- <div id="contentContainer"> --> <div id="content"> <div id="oversizeContent"> <p>You can see the black border on this green box,but you cAnnot see the bottom black border. Similarly you cAnnot see the bottom arrow of the scrollbar.</p> <p>I tried putTing a wrapper around the content and putTing the margin on that but the scrollbar still over flows Uncomment the contentContainer div and comment/uncomment the corresponding css.</p> </div> </div> <!-- <div> -->
CSS
html,body { height:100%; overflow:hidden; color:white; font-weight:bold; } #nav { height:50px; width:100%; BACkground-color:red; position:absolute; top:0; left:0; z-index: 2; } #contentContainer { /* uncomment this if you bring #contentContainer into play */ /* margin-top:50px; position:absolute; top:0; left:0; */ height:100%; width:100%; } #content { /* moving this into #contentContainer doesnt Help either */ /* comment this if you bring #contentContainer into play */ margin-top:50px; position:absolute; top:0; left:0; width:100%; height:100%; BACkground-color:blue; z-index: 1; overflow: auto; } #oversizeContent { BACkground-color:green; width:400px; height:1000px; border:10px solid black; }
以上是大佬教程为你收集整理的html – 100%高度div,由于margin-top 50px,滚动条50px关闭屏幕.溢出自动全部内容,希望文章能够帮你解决html – 100%高度div,由于margin-top 50px,滚动条50px关闭屏幕.溢出自动所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。