html - 导航栏空白

标签 html css

抱歉,这可能是一个非常简单的问题,但我已经搜索了两天,似乎找不到答案。这是我的第一个博客,我以前没有任何 CSS 或 html 的经验——从周日开始就一直在玩。这很有趣……也很令人沮丧。

无论如何...在我的新工作博客 (http://kentlawcso.blogspot.com/) 中,我在标题下的导航栏末尾有一大块空白。我在网上搜索并尝试了不同的解决方案,但我似乎无法找到摆脱空白和不导致“志愿者机会”进入下一行的正确平衡(如果它在 Chrome 中工作,它不在 IE 中)。该栏的代码如下。关于如何将导航栏一直延伸到右标题边框的任何想法。在某些浏览器中,增加填充也会将其推到下一行。

在此先感谢您的帮助!

#list-nav
{
padding:0;
overflow: hidden;
margin:-20;
}

#list-nav li 
{
display:inline;
}

#list-nav li a 
{   
font-family:Arial;
font-size:12px;
text-decoration: none;
float:left; 
padding:12px;
background-color: #333333;
color:#ffffff;
border-bottom:1px;
border-bottom-color:#000000;
border-bottom-style:solid;
}

#list-nav li a:hover 
{
background-color:#9B1C26;
padding-bottom:12px;
border-bottom:2px;
border-bottom-color:#000000;
border-bottom-style:solid;
margin:-1px;
}]]></b:skin>

最佳答案

这是我根据您的问题更改的 css。我已经在 firefox 中检查过了。

.header-outer {
    background: none repeat-x scroll 0 -400px #DDDDDD;
    margin-left: 3px;
    width: 776px;
}

.tabs-inner {
    /*padding: 0 15px;*/ /* i intentionally comment this to remove the padding */
}

.section {
    /*margin: 0 15px;*/ /* i intentionally comment this to remove the margin */
}

在下面的 div 上添加了内联样式(这个 div 就在 ul id="list-nav"之上)

<div style="width: 789px;" class="widget-content">


#list-nav {
    margin: 0;
    padding: 0;
    text-align: center;
}

#list-nav li a {
    background-color: #333333;
    border-bottom: 1px solid #000000;
    color: #FFFFFF;
    display: block;
    float: left;
    font-family: Arial;
    font-size: 12px;
    margin-right: 4px;
    padding: 12px;
    text-decoration: none;
}

请参阅下面的屏幕截图以了解 firefox 中的输出

enter image description here

关于html - 导航栏空白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9648595/

相关文章:

java - 在 Web 应用程序中显示 Excel 工作表 - Java EE

html - 如何将 float 子 div 的高度扩展到父级的高度?

javascript - 使用异步JS绘制DIV

css - 如何在不重置计数器的情况下在列表中使用 CSS 计数器?

javascript - 如何在 js 中获取被忽略的样式属性?

css - 为什么 Firefox 在调整页面大小时重新请求字体?

html - 如何最后加载@font-face

html - 在 Web Audio API 中使用 playbackRate.value 时如何获取当前时间

php - Wordpress query_posts() 不显示旧帖子

html - 如何重新设计或删除按钮(聚焦)的内边框