1

我目前正在向网页添加导航栏。但我遇到了一些 CSS 样式问题。导航菜单栏正在推送下面的内容,中间留下了巨大的空隙,使其参差不齐。我采取了预防措施,省略了任何会弄乱底部的东西,margin bottom-padding但我仍然得到相同的结果。如何让菜单栏不影响下面的内容?例子

添加导航栏后: 在此处输入图像描述

没有导航栏,下面的内容是偶数: 在此处输入图像描述

我已将导致问题的特定 css 规则添加到devgrow.css

<style>
#navigation {
    position:relative;
    top:-45px;
    left:450px;
}

#au_title {
    color: #FC821D;
    font-size: 120%;
    font-weight: bold;
    left: 515px;
    letter-spacing: 2px;
    position: relative;
    text-transform: uppercase;
    top: -105px;
}

#searchInput {
    left: 700px;
    position: relative;
    top: -180px;
}

#contentNav { color: #cfdae3; }


/* Dark Button CSS */
.buttonNav {
    outline: 0;
    padding: 5px 12px;
    display: block;
    color: #EBEBEB;
    font-weight: bold;
    text-shadow: 1px 1px #1f272b;
    border: 1px solid #1c252b;
    border-radius: 3px;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    background: #232B30; /* old browsers */
    background: -moz-linear-gradient(top, #3D4850 3%, #313d45 4%, #232B30 100%); /* firefox */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(3%,#3D4850), color-stop(4%,#313d45), color-stop(100%,#232B30)); /* webkit */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3D4850', endColorstr='#232B30',GradientType=0 ); /* ie */
    box-shadow: 1px 1px 1px rgba(0,0,0,0.2); /* CSS3 */
    -moz-box-shadow: 1px 1px 1px rgba(0,0,0,0.2); /* Firefox */
    -webkit-box-shadow: 1px 1px 1px rgba(0,0,0,0.2); /* Safari, Chrome */
}
.buttonNav:hover {
    color: #fff;
    background: #4C5A64; /* old browsers */
    background: -moz-linear-gradient(top, #4C5A64 3%, #404F5A 4%, #2E3940 100%); /* firefox */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(3%,#4C5A64), color-stop(4%,#404F5A), color-stop(100%,#2E3940)); /* webkit */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4C5A64', endColorstr='#2E3940',GradientType=0 ); /* ie */
}
.buttonNav:active {
    background-position: 0 top;
    position: relative;
    top: 1px;
    color: #fff;
    padding: 6px 12px 4px;
    background: #20282D; /* old browsers */
    background: -moz-linear-gradient(top, #20282D 3%, #252E34 51%, #222A30 100%); /* firefox */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(3%,#20282D), color-stop(51%,#252E34), color-stop(100%,#222A30)); /* webkit */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#20282D', endColorstr='#222A30',GradientType=0 ); /* ie */
    -moz-box-shadow: 1px 1px 1px rgba(255,255,255,0.1); /* Firefox */
    -webkit-box-shadow: 1px 1px 1px rgba(255,255,255,0.1); /* Safari, Chrome */
    box-shadow: 1px 1px 1px rgba(255,255,255,0.1); /* CSS3 */
}

/* Other stuff: */
.button-list { list-style: none; width: 100%; float: left; display: block; }
.button-list li { float: left; margin: 0 5px 0 0; }
.button-list li.search { padding-left: 18px; margin-left: 10px; position: relative; }

/* Search CSS: */
.search-input {
    padding: 0 5px 0 22px;
    border: 2px solid #DADADA;
    height: 30px;
    font-size: 12px;
    line-height: 30px;
    border-radius: 25px;
    -moz-border-radius: 25px;
    -webkit-border-radius: 25px;
    background: #FFF; /* old browsers */

}
.search-input:focus {outline: none;}

.search-submit {
    width: 13px;
    height: 13px;
    border: none;
    background: url(images/mag-glass.png) no-repeat;
    display: block;
    position: absolute;
    left: 26px;
    top: 10px;
    text-indent: -9999em;
}
</style>
4

3 回答 3

3

首先我要说编码真的很糟糕。为了解决该问题,请从您那里删除浮动button-list。像这样写:

.button-list {
    list-style: none outside none;
    overflow: hidden;
}
于 2012-08-09T04:43:01.553 回答
0

嘿,现在在你的 css id中定义 overflow hidden#contentArea

像这样

#contentArea {
    overflow: hidden;

}
于 2012-08-09T04:38:38.827 回答
0

在第一个内容区域的 css 中添加样式 clear

<div id="contentArea" style="clear:both">
于 2012-08-09T04:42:14.360 回答