html - 鼠标悬停时缺少导航下拉背景

标签 html css

我正在这个网站上工作:http://www.problemio.com如果您将鼠标悬停在页面顶部的“类别”导航项上,您将看到缺少的背景。

这是我使用的 css:

.menusystem 
{
    position: absolute;
    font-size: 1em;
    color: white;
}

.menusystem ul, .menusystem li 
{
    margin: 0;
    padding: 0;
}
.menusystem li 
{
    list-style: none outside none;
}

.menusystem ul 
{
    list-style: none;
}

.menusystem ul li ul 
{
    display: none;
    position: absolute;
    top: 1.6em;
    right: 0;
}

.menusystem li a 
{
    text-decoration: none;
}

.menusystem ul li.main_menu_li 
{
    padding-right: 20px;
    padding-left: 20px;
    margin-top: 7px;
    margin-bottom: 7px; 

    display: block;
    float:right;

    margin-right:0.2em;
    text-align: center;
    border-left: solid 1px white;   
/*  line-height: 1em;   */
    height: 15px;
}

.menusystem ul li.main_menu_li_left
{
    padding-left: 20px;
    padding-right: 20px;
    margin-top: 7px;    
    margin-bottom: 7px;     

    display: block;
    float:right;
    margin-right:0.2em;
    text-align: center;


/*  line-height: 1em;   */
    height: 15px;   
}

/* IE-Win (Holly hack) reads the list item line breaks, so lets hide those \*/
* html ul li { float: left; }
* html ul li a { height: 1%; }


.menusystem li:hover ul, .menusystem li.mouseHover ul { 
    display: block;
}

.menusystem li ul.child_menu_ul li a
{
    color: #fff;


    font-size: 80%;
    text-shadow: none;
    -moz-border-radius: 0px;
    -webkit-border-radius: 0px;
    border-bottom: 1px solid #2e6ea4;
    border-top: 0px;
    background: none repeat scroll 0 0 #2E6EA4;
}


.menusystem li ul.child_menu_ul li.first a
{
    -moz-border-radius-topleft: 14px;
    -moz-border-radius-topright: 14px;
    -webkit-border-top-left-radius: 14px;
    -webkit-border-top-right-radius: 14px;
    -moz-border-radius-bottomleft: 0;
    -moz-border-radius-bottomright: 0;
    -webkit-border-bottom-left-radius: 0;
    -webkit-border-bottom-right-radius: 0;
    border-top: 1px solid #2e6ea4;
}


.menusystem li ul.child_menu_ul li.last a
{
    -moz-border-radius-topleft: 0px;
    -moz-border-radius-topright: 0px;
    -webkit-border-top-left-radius: 0px;
    -webkit-border-top-right-radius: 0px;
        -moz-border-radius-bottomleft: 14px;
    -moz-border-radius-bottomright: 14px;
    -webkit-border-bottom-left-radius: 14px;
    -webkit-border-bottom-right-radius: 14px;
}


.menusystem li ul.child_menu_ul li a:hover 
{
    color: #ff0;
    background: #2e6ea4; 
}

/*.menusystem li.main_menu_li a */
.menusystem ul.child_menu_ul a
{
    color: #fff;            
    text-shadow: 1px 1px 1px rgba(0,0,0,0.9);
}

.menusystem li.main_menu_li a:hover 
{
    color: orange;
}

有人可以告诉我如何使背景变成某种棕色或深色吗?谢谢!

最佳答案

这很简单。您只需要定位下拉菜单 ul 并设置一个 background-color:

.menusystem ul li ul {
    display: none;
    position: absolute;
    top: 1.6em;
    right: 0;
    background-color: #391C07; /* add this */
}

显然,您可以将十六进制代码 #391C07 更改为您希望显示的任何颜色。

关于html - 鼠标悬停时缺少导航下拉背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8408085/

相关文章:

javascript - 如何用没有名称或 ID 的 JavaScript 替换标签中的文本?

javascript - 当页面仍在等待远程图像时防止显示图像 URL

html - CSS三 Angular 形边框

html - 如何制作 Bootstrap "table-bordered"Fixed header 和 Scroll body?

javascript - 如何在单击按钮时显示隐藏的 div 并在 Angular 2 中隐藏单击的按钮?

html - 如何使用 bootstrap 和 css 使元素响应?

css - <div>内<a>,seo优化

html - INPUT 和 SELECT 元素自定义大小

html - Flexbox 对齐内容 : center not working properly in Safari

html - 如何修复 Wordpress 网站背景图片?