对于这个愚蠢的问题感到抱歉,但由于某种原因,这部分HTML / CSS布局总是让我...
我在http://kdmalikdesign.com/test/LinguisticPeers/index.html有一个网站。只是练习HTML / CSS / jQuery,最后是PHP /数据库。
在Chrome中,页脚的结尾太长了。在firefox中,页脚大约是我想要的三倍,在safari中也是如此。现在我在html和body上有100%的高度,以便背景图像扩展到显示的所有内容。
为了补偿页脚(现在太长),我是否必须使主容器的长度最小,以便页脚可以容纳空间?对此有一般的设计规则吗?还是CSS规则?
基本上发生的事情是我喜欢标题和主容器看起来的方式,但由于它没有填满整个浏览器窗口,它最终使得页脚太长了或者如果html,正文100%不存在,页脚下方有一个空白区域。如果您想快速检查,我的CSS代码如下。
html,身体上唯一的高度是100%。标题高度为100像素,每个容器为160像素。页脚也是55px。
html, body, div, header, footer, article, h2 {
margin: 0px;
padding: 0px;
}
html, body {
height: 100%;
background-image: url('images/bkg-img.jpg');
background-repeat: repeat;
}
header {
background: #6888fd; /* Old browsers */
background: -moz-linear-gradient(top, #6888fd 0%, #1c46e9 55%, #0330e4 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6888fd), color-stop(55%,#1c46e9), color-stop(100%,#0330e4)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #6888fd 0%,#1c46e9 55%,#0330e4 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #6888fd 0%,#1c46e9 55%,#0330e4 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #6888fd 0%,#1c46e9 55%,#0330e4 100%); /* IE10+ */
background: linear-gradient(to bottom, #6888fd 0%,#1c46e9 55%,#0330e4 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6888fd', endColorstr='#0330e4',GradientType=0 ); /* IE6-9 */
height: 100px;
}
#background-container {
padding-top: 50px;
padding-bottom: 25px;
}
#container {
margin: 0 auto;
background-color: #587DFF;
height: 230px;
width: 830px;
text-align: center;
padding-top: 100px;
-moz-border-radius: 25px;
border-radius: 25px;
}
#article-container {
width: 960px;
margin: 0 auto;
}
article {
border: 4px solid #9AADFA;
background-color: #002DE2;
color: #fff;
width: 280px;
height: 160px;
float: left;
margin-left: 30px;
margin-top: 25px;
/*
display:-moz-inline-stack;
display:inline-block;
zoom:1;
*display:inline;
*/
}
.clear {
clear: both;
}
span {
display: block;
padding-top: 10px;
color: #6D8EFF;
}
h2 {
padding-left: 10px;
padding-top: 5px;
}
p {
padding-left: 5px;
padding-right: 5px;
}
footer {
text-align: center;
border-top: 1px solid #7493FF;
background-image: url('images/bkg-img.jpg');
background-repeat: repeat;
height: 55px;
}
nav {
float: right;
color: #84A0FF;
position: relative;
top: 60px;
left: -75px;
}
nav ul {
list-style-type: none;
}
nav ul li {
display: inline;
padding-left: 10px;
}
#login-container {
float: right;
padding-right: 50px;
padding-top: 25px;
color: #fff;
position: relative;
left: 450px;
}
#header-container {
margin: 0 auto;
width: 960px;
height: 100px;
}