0

下拉式菜单

目前,只有当鼠标悬停在电话图标或小箭头区域附近时,当您向下移动光标单击下拉菜单中的链接时,下拉菜单不会消失。

当有人将鼠标悬停在“联系人”一词上时,他一移动光标,下拉菜单就会消失。当用户将光标从单词 'Contact' 向下移动时,我希望下拉菜单保持不变。

HTML:

<!DOCTYPE html>
<html>
<head>
<title></title>

<link rel="stylesheet" href="style2.css" type="text/css" />

</head>
<body>

    <div class="Navigation">

        <div id="navbar">
                <ul>
                    <li class="OP" id="OPM1"><img src="images/order.png"   /><a  href="Orders.html">Orders</a></li>

                    <li class="OP"><img src="images/contact.png" /><a href="ContactUs.html">Contact</a>
                            <div class="extended">
                                <div class="arrow-up"></div>

                                <ul class="smallNav">
                                    <li><a href="#">+65-65553333</a></li>
                                    <li><a href="http://www.facebook.com/pages/yourfanpage/12345678" target="_blank">Facebook</a></li>
                                    <li><a href="http://twitter.com/yourtwitter" target="_blank">Twitter</a></li>
                                    <li><a href="www.gmail.com" target="_blank">enquiry [at] foodstant [dot] com</a></li>
                                </ul>
                            </div>
                        </li>

                        </ul>

</div>
</div>
</body>
</html>

CSS:

.Navigation { background:background: rgb(246,248,249); /* Old browsers */
    background: -moz-linear-gradient(top,  rgba(246,248,249,1) 0%, rgba(229,235,238,1) 46%, rgba(215,222,227,1) 65%, rgba(245,247,249,1) 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(246,248,249,1)), color-stop(46%,rgba(229,235,238,1)), color-stop(65%,rgba(215,222,227,1)), color-stop(100%,rgba(245,247,249,1))); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top,  rgba(246,248,249,1) 0%,rgba(229,235,238,1) 46%,rgba(215,222,227,1) 65%,rgba(245,247,249,1) 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top,  rgba(246,248,249,1) 0%,rgba(229,235,238,1) 46%,rgba(215,222,227,1) 65%,rgba(245,247,249,1) 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top,  rgba(246,248,249,1) 0%,rgba(229,235,238,1) 46%,rgba(215,222,227,1) 65%,rgba(245,247,249,1) 100%); /* IE10+ */
    background: linear-gradient(to bottom,  rgba(246,248,249,1) 0%,rgba(229,235,238,1) 46%,rgba(215,222,227,1) 65%,rgba(245,247,249,1) 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f6f8f9', endColorstr='#f5f7f9',GradientType=0 ); /* IE6-9 */ 
    border-top-left-radius: 10px;
    border-bottom-left-radius:10px;
    border-top-right-radius: 10px; 
    border-bottom-right-radius:10px;

    box-shadow: -3px -5px 10px  #888888;
    font-size: 26px;

    font-family: 'Conv_LITHOSPRO-REGULAR';
}

.Navigation ul li {  position: relative; list-style: none; padding: 17px 10px; }

.Navigation ul li a { font-size: 26px; font-weight: bold; color: white; text-decoration: none; text-shadow: 0 1px 2px black; }

.Navigation ul li:hover { background: url(images/hover.png) repeat-x; height: 43px; -webkit-box-shadow: 0 0px 2px black inset; padding: 20px 9px; border-left: 1px solid #a4a4a4; border-right: 1px solid #a4a4a4;} 

.Navigation ul li:hover { background: none; -webkit-box-shadow: none; -moz-box-shadow: none; height: auto; border: none; }


.arrow-up { width: 0; height: 0; border-left: 10px solid transparent; border-right: 10px solid transparent; border-bottom: 15px solid #6a6a63; position: absolute; left: 20px; top: -15px; }

.Navigation  ul li .extended { position: absolute; top: 45px; left: 0; width: 220px; background: url(images/dropdownback.png); z-index: 1000; -moz-box-shadow: 0 0px 8px rgba(0,0,0,0.8); -webkit-box-shadow: 0 0px 8px rgba(0,0,0,0.8); box-shadow: 0 0 8px black; -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; border: 1px solid white; display: none; color: white; }

.Navigation  ul li .extended img { display: block; margin: 5px auto 15px auto; -webkit-box-reflect:below 0px -webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(0.8, transparent), to(rgba(255,255,255,0.5))); }

.Navigation  ul li .extended a { font-size:14px;}

.Navigation  ul li .extended h2, .Navigation ul li .ultraNav h2 { padding-top: 10px; padding-left: 10px; font-size: 16px; text-shadow: 0 1px 2px black; color: white; background: url(images/headerback.png) repeat-x; height: 20px; border-radius: 3px; -webkit-border-radius: 3px; -moz-border-radius: 3px;  }

.Navigation ul li .extended span { padding-left: 10px; font-size: 11px; }

.Navigation  ul li .extended ul.smallNav { border-top: 1px solid rgba(141,141,141,0.50);  padding: 10px; height: 100px;  }

.Navigation ul li .extended ul.smallNav li { width: 200px; padding: 0; line-height: 22px; font-weight: bold; background: url(images/linkback.png) no-repeat; }

.extended ul li {float:left;}

.Navigation  ul li .extended ul.smallNav li:first-child { margin: 0; }

.Navigation  ul li .extended ul.smallNav li:last-child { margin-bottom: 10px; }

.Navigation ul li:hover .extended { display: block; }

.Navigation ul li ul li:hover a { color: white; } 

#navbar {

}

#navbar ul {
    list-style-position:inside;
    padding-top: 10px;
    padding-bottom: 10px;
}


#navbar ul li {     
        display: inline;
        padding:0 20px 0px 0px; 
        margin-bottom: 10px;
        list-style-type:disc;
    }

#navbar ul li.OP {
        padding-left: 15px;

}   

#navbar ul li.OP img {
    vertical-align: middle; 
}

#navbar li a:link {
  color: #EF174A;
  }

#navbar li a:visited {
  color: #BF4100;
  }

 #navbar li a:hover {
  color: black;
  background-color:#D2D2D2;
  border-radius: 10px; 
  }

 #navbar li a:active {
  color: #918FBC;
  } 

li a {
    text-decoration:none;
}  

#navbar ul li.OP a {
    padding-left: 10px;
}

.Navigation  ul li .extended ul.smallNav li a { color: #c7c7c7 !important; text-shadow: none !important;  } 

.Navigation ul li .extended ul.smallNav li a:hover { color: white !important;} 
4

1 回答 1

2

用另一个 DIV包装arrow-upDIV,如下所示:

<div class="arrow-container"><div class="arrow-up"></div></div>

然后将arrow-container样式添加为:

.arrow-container { margin-top:-16px; height:16px; }
于 2012-08-10T10:15:03.040 回答