前輩們,怎麼把下拉式改為點擊才會出現下拉式選單~
不然移標過去就回直接顯示下拉式清單~
是要多寫個jacascript去控制嗎?
HTML
<html lang="en" >
<head>
<meta charset="utf-8" />
<title>TEST</title>
<link href="css/layout.css" rel="stylesheet" type="text/css" />
<link href="css/menu.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" media="screen and (min-width: 1920px) and (max-width: 2560px)" href="css/123.css" />
<link rel="stylesheet" media="screen and (device-width: 360px) and (device-height:640px)"
href="css/1234.css" />
</head>
<body>
<header >
<h2>TEST</h2>
<a href="logout.php" class="stuts">Sign out</a>
</header>
<ul id="nav" >
<li><a href="mainpage.php" style="font-family:Microsoft JhengHei;">Home</a>
</li>
<li><a href="">下拉1</a>
<ul>
<li><a href="check.php"target="_blank">下拉2</li>
<li><a href="check2.php"target="_blank">下拉3</li>
</ul>
</li>
<li><a href="">TEST</a>
<ul>
<li><a href="excel/index.html"target="_blank">Excel上傳(TEST)</a></li>
</ul>
</li>
<li><a href="">TEST</a>
<ul>
<li><a href="excel/index.html"target="_blank">Excel上傳(TEST)</a></li>
</ul>
</li>
<li><a href="">TEST</a>
<ul>
<li><a href="excel/index.html"target="_blank">Excel上傳(TEST)</a></li>
</ul>
</li>
<li><a href="">帳戶資料維護</a>
<ul>
<li><a href="update_password.php">修改密碼</li>
<li><a href="logout.php">帳號登出</a></li>
</ul>
</li>
</ul>
<script src="js/script.js"></script>
</body>
</html>
CSS
#nav,#nav ul {
list-style: none outside none;
margin: 0;
padding: 0;
}
#nav {
font-family: "Lucida Sans Unicode",Verdana,Arial,sans-serif;
font-size: 15px;
height: 41px;
list-style: none outside none;
margin: 40px auto;
text-shadow: 0 0px 0px #202020;
width: 1090px;
/* border radius */
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
/* box shadow */
-moz-box-shadow: 0px 3px 3px #cecece;
-webkit-box-shadow: 0px 3px 3px #cecece;
box-shadow: 0 3px 4px #8b8b8b;
/* gradient */
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eeeeee), color-stop(0.5, #eeeeee), color-stop(0.51, #eeeeee), color-stop(1, #eeeeee));
background-image: -moz-linear-gradient(center bottom, #eeeeee 0%, #eeeeee 50%, #eeeeee 51%, #eeeeee 100%);
background-color: #cc0000;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}
#nav li {
border-bottom: 1px solid #eeeeee;
border-left: 1px solid #eeeeee;
border-right: 1px solid #eeeeee;
border-top: 1px solid #eeeeee;
display: block;
float: left;
height: 35px;
position: relative;
width: 179px;
}
#nav > li:first-child {
border-left: 0 none;
margin-left: 5px;
}
#nav ul {
left: -9999px;
position: absolute;
top: -9999px;
z-index: 2;
}
#nav ul li {
text-align:left;
background: none repeat scroll 0 0 #838383;
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.5);
width: 150px;
}
#nav li a {
width: 150px;
color: #000000;
display: block;
line-height: 40px;
outline: medium none;
text-align: center;
text-decoration: none;
/* gradient */
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eeeeee), color-stop(0.5, #eeeeee), color-stop(0.51, #eeeeee), color-stop(1, #eeeeee));
background-image: -moz-linear-gradient(center bottom, #eeeeee 0%, #eeeeee 50%, #eeeeee 51%, #eeeeee 100%);
background-color: #5f5f5f;
}
/* keyframes #animation */
@-webkit-keyframes animation {
0% {
-webkit-transform: scale(1);
}
30% {
-webkit-transform: scale(1.2);
}
100% {
-webkit-transform: scale(1.1);
}
}
@-moz-keyframes animation {
0% {
-moz-transform: scale(1);
}
30% {
-moz-transform: scale(1.2);
}
100% {
-moz-transform: scale(1.1);
}
}
#nav li > a:hover {
/* CSS3 animation */
-webkit-animation-name: animation;
-webkit-animation-duration: 0.3s;
-webkit-animation-timing-function: linear;
-webkit-animation-iteration-count: 1;
-webkit-animation-direction: normal;
-webkit-animation-delay: 0;
-webkit-animation-play-state: running;
-webkit-animation-fill-mode: forwards;
-moz-animation-name: animation;
-moz-animation-duration: 0.3s;
-moz-animation-timing-function: linear;
-moz-animation-iteration-count: 1;
-moz-animation-direction: normal;
-moz-animation-delay: 0;
-moz-animation-play-state: running;
-moz-animation-fill-mode: forwards;
}
#nav li:hover ul {
left: 0;
top: 34px;
width: 150px;
}