HTML/CSS 填充问题

标签 html css

这就是我正在做的:jsfiddle code

* {
    margin: 0;
    padding: 0;
}
html {
    height: 100%;
}
header, nav, section, article, aside, footer {
    display: block;
}
body {
    font: 12px/18px Arial, Tahoma, Verdana, sans-serif;
    width: 100%;
    height: 100%;
}
a {
    color: blue;
    outline: none;
    text-decoration: underline;
}
a:hover {
    text-decoration: none;
}
p {
    margin: 0 0 18px
}
img {
    border: none;
}
input {
    vertical-align: middle;
}
#wrapper {
    width: 1000px;
    margin: 0 auto;
    min-height: 100%;
    height: auto !important;
    height: 100%;
}
.menu {
    background-color: #c00e0e;
    opacity: 0.5;
    filter: Alpha(opacity=50);
    /* IE8 and earlier */
    clear: both;
    margin: 0 auto;
    width: 730px;
    text-align: center;
    color: #FFF;
    border-radius: 5px;
    box-shadow: 0px 0px 4px 2px rgba(0, 0, 0, 0.4);
}
.menu ul {
    list-style: none;
    margin: auto;
    display: block;
}
.menu ul li {
    display: inline-block;
    width: auto;
    height: 42px;
    padding: 0;
    font-family:'Chela One', cursive, Helvetica, sans-serif;
    font-size: 20px;
}
.menu ul li a {
    height: 42px;
    width: auto;
    float: left;
    text-decoration: none;
    padding: 0 0 0 25px;
    margin: 0px 10px 0px 10px;
    color: #fff;
    text-align: center;
}
.menu ul li a:hover {
    height:42px;
    width: auto;
    text-decoration: none;
    color: #000000;
}
.menu ul li a.current {
    height: 42px;
    width: auto;
    float: left;
    text-decoration: none;
    padding: 0px;
    color: #fff;
}
/* Header------------------------------------------*/
#header {
    height: 291px;
    background: #FFE680 url('http://i43.tinypic.com/2ivb7mh.png') no-repeat;
    padding-top: 30px;
}
.big {
    font-family:'Luckiest Guy', cursive;
    font-size: 50px;
    margin: 0px auto;
    padding-top: 50px;
    text-align: center;
    color: #FFF;
}
/* Middle--------------------------------------*/
#content {
    text-align: center;
    margin: auto;
    padding: 0 0 800px;
    background-color: #343436;
}
.footer_misc {
    background-color: #000;
    width: 1000px;
    position: relative;
    margin: 0 auto;
    text-align: center;
    color: #FFF;
    height: 50px;
}
/* Footer-------------------------------------------------------*/
#footer {
    width: 1000px;
    margin: -100px auto 0;
    height: 100px;
    background: #b40b0b;
    position: relative;
}
/* tell the imgwithtxt's children to float left: */
.imgwithtxt > * {
    float:left;
    margin-right:5px;
}
/* this is called a clearfix. it makes sure that the imgwithtxt's children floats are cleared, without using extra markup */
.imgwithtxt {
    *zoom:1
    /* for IE */
}
.imgwithtxt:before, .imgwithtxt:after {
    content:" ";
    display: table;
}
.imgwithtxt:after {
    clear: both;
}
/* end clearfix*/
#title {
    text-align:center;
    font-size: 20px;
    color: #FFF;
    margin: 10px auto;
    font-family:'Luckiest Guy', cursive;
}
.columns {
    width: 1000px;
    text-align: center;
    margin: 0 auto;
    padding: 0 auto;
}
.col1 {
    float: left;
    width: 200px;
}
.col2 {
    float: left;
    width: 200px;
}
.col3 {
    float: left;
    width: 200px;
}

当您运行代码时,它会在内容之前变成黄色背景。我的 CSS 中应该遗漏什么?我只希望我的菜单框有一个填充,这样它就不会在顶部。我试图解决这个问题但无济于事。我很乐意感谢你的帮助。谢谢。

最佳答案

这就是你的意思,消除页眉的背景色,因为那设置为黄色。 fiddle 在下面。

http://jsfiddle.net/BAKjU/4/

background color:#333;

关于HTML/CSS 填充问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18370924/

相关文章:

javascript - 新行和制表符以 Angular 添加到我的字符串中

javascript - 在 YUI 中获取点击项的索引

jquery - 响应式裁剪图像,保持图像中心可见(水平)

html - iOS5 中基于元素的 native 滚动

html - 文本溢出 : ellipsis isn't working-why?

javascript - 最小尺寸与纵横比调整图像大小

php - onchange 用于动态添加的行

html - 列表元素中的 anchor 未用显示 :block and height/width set to 100% 填充可用空间

css - 从大字体到小字体的动画弄乱了定位

html - 表格高度为 100% 的滚动表格单元格