更改子项目字体颜色

时间:2013-08-13 01:41:51

标签: html css

我使用Dreamweaver,这是我第一次使用它,我找不到更改子项菜单颜色的代码以及如何在下拉列表中悬停时更改背景。

*{
        margin:0;
        padding:0;
    }
    ul.MenuBarHorizontal
    {
        margin: 0;
        padding: 0;
        list-style-type: none;
        font-size: 100%;
        cursor: default;
        background:url(../images/menu5.png) no-repeat;
        width:420px;
        height:58px;
    }
    /* Set the active Menu Bar with this class, currently setting z-index to accomodate IE rendering bug: http://therealcrisp.xs4all.nl/meuk/IE-zindexbug.html */
    ul.MenuBarActive
    {
        z-index: 1000;
    }
    /* Menu item containers, position children relative to this container and are a fixed width */
    ul.MenuBarHorizontal li
    {
        margin: 0;
        padding: 0;
        list-style-type: none;
        font-size: 100%;
        position: relative;
        cursor: pointer;
        float: left;
    }

    /* Submenus should appear below their parent (top: 0) with a higher z-index, but they are initially off the left side of the screen (-1000em) */
    ul.MenuBarHorizontal ul
    {
        margin: 0;
        padding: 0;
        list-style-type: none;
        font-size: 100%;
        z-index: 1020;
        cursor: default;
        position: absolute;
        left: -1000em;
    }
    /* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to auto so it comes onto the screen below its parent menu item */
    ul.MenuBarHorizontal ul.MenuBarSubmenuVisible
    {
        left: auto;
    }
    /* Menu item containers are same fixed width as parent */
    ul.MenuBarHorizontal ul li
    {
        width: 6.2em;
    }
    /* Submenus should appear slightly overlapping to the right (95%) and up (-5%) */
    ul.MenuBarHorizontal ul ul
    {
        position: absolute;
        margin: -5% 0 0 95%;
    }
    /* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to 0 so it comes onto the screen */
    ul.MenuBarHorizontal ul.MenuBarSubmenuVisible ul.MenuBarSubmenuVisible
    {
        left: auto;
        top: 0;
    }

    /*******************************************************************************

     DESIGN INFORMATION: describes color scheme, borders, fonts

     *******************************************************************************/

    /* Submenu containers have borders on all sides */
    ul.MenuBarHorizontal ul
    {
        background-color:#00b1ef;
        padding-top: 2px;
        padding-right: 0px;
        padding-bottom: 2px;
        padding-left: 0px;
        margin:0;
    }
    /* Menu items are a light gray block with padding and no text decoration */
    ul.MenuBarHorizontal li a
    {
        display: block;
        color: gray;
        text-decoration: none;
        font-family:verdana;
        font-size:8px;
    }
    ul.subItem li a.subHover {
        font-color:#fff;
    }
    /* Menu items that have mouse over or focus have a blue background and white text */
    ul.MenuBarHorizontal a:hover, ul.MenuBarHorizontal a:focus
    {
        background:url(../images/hover.jpg) no-repeat;
        /**color: #FFF;**/
    }

    /* Menu items that are open with submenus are set to MenuBarItemHover with a blue background and white text */
    ul.MenuBarHorizontal a.MenuBarItemHover, ul.MenuBarHorizontal a.MenuBarItemSubmenuHover, ul.MenuBarHorizontal a.MenuBarSubmenuVisible
    {
        background:url(../images/hover.jpg) no-repeat;
        color: #FFF;
    }

    /*******************************************************************************

     SUBMENU INDICATION: styles if there is a submenu under a given menu item

     *******************************************************************************/

    /* Menu items that have a submenu have the class designation MenuBarItemSubmenu and are set to use a background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarHorizontal a.MenuBarItemSubmenu
    {
        background-repeat: no-repeat;
        background-position: 95% 50%;
    }
    /* Menu items that have a submenu have the class designation MenuBarItemSubmenu and are set to use a background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarHorizontal ul a.MenuBarItemSubmenu
    {
        background-repeat: no-repeat;
        background-position: 95% 50%;
    }
    /* Menu items that are open with submenus have the class designation MenuBarItemSubmenuHover and are set to use a "hover" background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarHorizontal a.MenuBarItemSubmenuHover
    {
        background-repeat: no-repeat;
        background-position: 95% 50%;
    }
    /* Menu items that are open with submenus have the class designation MenuBarItemSubmenuHover and are set to use a "hover" background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarHorizontal ul a.MenuBarItemSubmenuHover
    {
        background-repeat: no-repeat;
        background-position: 95% 50%;
    }

    ul.MenuBarHorizontal iframe
    {
        position: absolute;
        z-index: 1010;
        filter:alpha(opacity:0.1);
    }

    #MenuBar1 li ul li a.subHover {
        font-size:9px;
        padding-top: 5px;
        padding-right: 3px;
        padding-bottom: 5px;
        padding-left: 3px;
        font-color:#fff;
    }
    #MenuBar1 li ul li a.subHover:hover {
        background-color:yellow;
    }
    #MenuBar1 li a {
        text-decoration: none;
        text-align: center;
        vertical-align: middle;
        list-style-type: none;
    }

我也尝试为它创建新规则但不起作用。我很感激你的帮助:)。

1 个答案:

答案 0 :(得分:0)

只是快速查看你的css和html,看来子项中的悬停效果是在以下CSS规则中设置的

#MenuBar1 li ul li a.subHover:hover {
   background-color: #FF0;
}

ul.MenuBarHorizontal a:hover, ul.MenuBarHorizontal a:focus {
   background: url(http://www.comgtech.com/images/hover.jpg) no-repeat;
}

没有悬停的背景颜色在UL

的规则中设置
ul.MenuBarHorizontal ul {
   background-color: #79B1C5;
   padding-top: 2px;
   padding-right: 0px;
   padding-bottom: 2px;
   padding-left: 0px;
   margin: 0;
}