Html 分辨率高于1024x768的页面底部空白
我试图设计的网页似乎只适合1024x768分辨率。分辨率较高时,屏幕底部会有大量空白。我对CSS相当陌生,但我很确定这个错误与缺少position属性有关。我要么希望页脚和主div位于屏幕底部,要么让页面缩放。如果有人能告诉我我错过了什么,我将永远感激Html 分辨率高于1024x768的页面底部空白,html,css,Html,Css,我试图设计的网页似乎只适合1024x768分辨率。分辨率较高时,屏幕底部会有大量空白。我对CSS相当陌生,但我很确定这个错误与缺少position属性有关。我要么希望页脚和主div位于屏幕底部,要么让页面缩放。如果有人能告诉我我错过了什么,我将永远感激 在html和正文上使用100%高度,在包装上使用100%高度,包括元素上的绝对位置,即: html, body { height: 100%; } #wrapper { background-image: url("../ima
在html和正文上使用100%高度,在包装上使用100%高度,包括元素上的绝对位置,即:
html, body {
height: 100%;
}
#wrapper {
background-image: url("../images/bg-repeat.png");
background-repeat: repeat;
height: 100%;
min-width: 768px;
position: relative;
}
#main {
bottom: 21px; /* lifting it up 21px from bottom to allow for footer slotting in */
height: auto;
left: 0; /* change accordingly to left position */
min-height: 309px;
position: absolute;
width: 768px;
}
然后您还希望页脚保持在底部-将其设置为绝对定位,底部为0。
另外,我会使用
#wrapper
中的类,而不是id中的类。将wrapper div中的背景添加到页面主体中
body {
background-image: url(http://www.eightbitbastards.com/8bbtest/images/bg-repeat.png);
background-repeat: repeat;
}
添加一个JSFiddle^-^或一点您尝试使用的代码。尝试在
html
、body
和#wrapper
元素上声明html
高度:100%。html
元素的大小也应调整为100%高度,即html,body{height:100%}
我试过了,但似乎什么都没变:c。谢谢你的尝试。我会在2分钟内修改我的答案。虽然我感谢你的帮助,但这不是我想要达到的目的;我希望包装适合的决议,并把页脚和主div的底部与它。