2

現在選択されているメニュー項目にカーソルを合わせると、色が変わるのを防ぎたいと思います。ここに私のコード。

<html>
    <head>
        <title> Another Page </title>
        <link rel="stylesheet" href="style4.css" type="text/css" />
    <head>

    <body>

        <div id="title">

            <ul>
                <li class="current"><a href="home.html">Home</a></li>
                <li><a href="content.html">Content</a></li>
                <li><a href="search.html">Search</a></li>
            </ul>

            <div id="clear">
            </div>

        </div>

        <div id="wrapper">

            <div id="header">


            </div>

        </div>

    </body>


</html>

これがCSSです

body
{
    padding: 0;
    margin: 0;
    background-color: rgb(24,205,20);
}

h1,h2,h3
{
    padding: 0;
    margin: 0;
}

p
{
    padding: 0;
    margin: 0;
}

.current
{
    background-color: black;

}


#title
{
    background-color: orange;   
}

#title ul
{

    list-style: none;
    padding: 0;
    margin: 0;
}

#title li
{
    float: left;
}

#title a
{
    text-transform: uppercase;
    text-align: center;
    text-decoration: none;
    display: block;
    width: 120px;
    font-weight: bold;
    color: #ffffff;
    padding: 4px;
}

#title a:hover
{
    background-color: rgb(180,138,18);
}

#clear
{
    clear: both;
}

この問題を解決するためのいくつかの緊急の提案が必要です。

ありがとうございました。

4

1 に答える 1

1

CSSファイルの最後に次の行を追加します。

#title .current a:hover {
        background-color: inherit;
}
于 2012-09-15T06:14:24.613 に答える