0

私は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;
    }

また、新しいルールを作成しようとしましたが、うまくいきません。私はあなたの助けに感謝します:)

4

1 に答える 1

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;
}
于 2013-08-13T09:52:47.347 に答える