子子菜单代码坏了吗?

时间:2017-04-17 21:19:11

标签: html css submenu

不确定我哪里出错了。似乎无法让我的子子菜单显示在“Supai”选项卡下。我哪里错了?我可以让子菜单工作,但不知何故Sub Sub将不会显示。唉

另外,我确信你已经厌倦了这些子子菜单问题。我已经挖掘了它们,甚至使用了本网站上的回复中使用的确切代码。它们工作正常.....直到我将它们粘贴到博客上的博客中。认为Blogger代码本身可能会有一些对我不利的事情。想法?

#cssnav {
     float: left;
    font: bold 12px Verdana, Helvetica, Sans-serif;
     border: 2px solid #74BA94;
     border-top: 1px solid #747BBA;
     -webkit-border-radius: 5px;
     -moz-border-radius: 5px;
     border-radius: 5px;
     overflow: hidden;
}

#cssnav ul {
 margin:0;
 padding:0;
 list-style:none;
}

#cssnav ul li {
 float:left;
}

#cssnav ul li a {
    float: left;
 color:#EA1047;
     padding: 10px 20px;
 text-decoration:none;
     background:#3F10EA;
  background: -webkit-gradient( linear, left bottom, left top, color-stop(0.09, rgb(59,63,65)), color-stop(0.55, rgb(72,76,77)), color-stop(0.78, rgb(75,77,77)) );
 background: -moz-linear-gradient( center bottom, rgb(59,63,65) 9%, rgb(72,76,77) 55%, rgb(75,77,77) 78% );
 background: -o-linear-gradient( center bottom, rgb(59,63,65) 9%, rgb(72,76,77) 55%, rgb(75,77,77) 78% );
 box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1) inset, 0 0 5px rgba(0, 0, 0, 0.1) inset;
 border-left: 1px solid rgba(255, 255, 255, 0.05);
        border-right: 1px solid rgba(0,0,0,0.2);
  text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.6);
}

#cssnav ul li a:hover,
#cssnav ul li:hover > a {
     color: #252525;
     background:#3C4042;
 background: -webkit-gradient( linear, left bottom, left top, color-stop(0.09, rgb(77,79,79)), color-stop(0.55, rgb(67,70,71)), color-stop(0.78, rgb(69,70,71)) );
 background: -moz-linear-gradient( center bottom, rgb(77,79,79) 9%, rgb(67,70,71) 55%, rgb(69,70,71) 78% );
 background: -o-linear-gradient( center bottom, rgb(77,79,79) 9%, rgb(67,70,71) 55%, rgb(69,70,71) 78% );
     text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2), 0 -1px #000;

}

#cssnav li ul a:hover, 
#cssnav ul li li:hover > a  {
    color: #2c2c2c;
   background: #5C9ACD;
 background: -webkit-gradient( linear, left bottom, left top, color-stop(0.17, rgb(61,111,177)), color-stop(0.51, rgb(80,136,199)), color-stop(1, rgb(92,154,205)) );
 background: -moz-linear-gradient( center bottom, rgb(61,111,177) 17%, rgb(80,136,199) 51%, rgb(92,154,205) 100% );
 background: -o-linear-gradient( center bottom, rgb(61,111,177) 17%, rgb(80,136,199) 51%, rgb(92,154,205) 100% );
     border-bottom: 1px solid rgba(0,0,0,0.6);
     border-top: 1px solid #7BAED9;
     text-shadow: 0 1px rgba(255, 255, 255, 0.3);
}

#cssnav li ul {
     background:#3C4042;
     background-image: -webkit-gradient( linear, left bottom, left top, color-stop(0.09, rgb(77,79,79)), color-stop(0.55, rgb(67,70,71)), color-stop(0.78, rgb(69,70,71)) );
     background-image: -moz-linear-gradient( center bottom, rgb(77,79,79) 9%, rgb(67,70,71) 55%, rgb(69,70,71) 78% );
     background-image: -o-linear-gradient( center bottom, rgb(77,79,79) 9%, rgb(67,70,71) 55%, rgb(69,70,71) 78% );
     border-radius: 0 0 10px 10px;
     -moz-border-radius: 0 0 10px 10px;
     -webkit-border-radius: 0 0 10px 10px;
     left: -999em;
     margin: 35px 0 0;
     position: absolute;
     width: 160px;
     z-index: 9999;
     box-shadow: 0 0 15px rgba(0, 0, 0, 0.4) inset; 
     -moz-box-shadow: 0 0 15px rgba(0, 0, 0, 0.4) inset; 
     -webkit-box-shadow: 0 0 15px rgba(0, 0, 0, 0.4) inset; 
     border: 1px solid rgba(0, 0, 0, 0.5);
}

#cssnav li:hover ul {
     left: auto;
}

#cssnav li ul a {
     background: none;
     border: 0 none;
     margin-right: 0;
     width: 120px;
     box-shadow: none;
     -moz-box-shadow: none;
     -webkit-box-shadow: none;
     border-bottom: 1px solid transparent;
     border-top: 1px solid transparent;
}

#cssnav li li ul {
     margin: -1px 0 0 160px;
     -webkit-border-radius: 0 10px 10px 10px;
     -moz-border-radius: 0 10px 10px 10px;
     border-radius: 0 10px 10px 10px;
     visibility:hidden;
}

#cssnav li li:hover ul {
     visibility:visible;
}

#cssnav ul ul li:last-child > a {
 -moz-border-radius:0 0 10px 10px;
 -webkit-border-radius:0 0 10px 10px;
 border-radius:0 0 10px 10px;
}

#cssnav li:hover ul ul {
  display:none; // hide the unordered list that is inside the unordered list
}
#cssnav li ul li:hover ul {
  display:block; // display the unordered list in the same way as your sub menu
}
#cssnav ul ul ul li:first-child > a {
 -moz-border-radius:0 10px 0 0;
 -webkit-border-radius:0 10px 0 0;
 border-radius:0 10px 0 0;
}
<!doctype html> 
<div id="cssnav">
<ul>
	<li><a href="www.example.com">Home</a></li>
	<li><a href="http://www.example.com/p/about-me.html">About Me</a></li>
	<li><a href="http://www.example.com/p/joc-series.html">JOC: Book Series</a></li>
	<li><a href="http://www.example.com/p/adventures.html">Adventures</a>
		<ul>
			<li><a href="http://www.example.com/p/adventures.html#SUP">Supai</a></li>
				<ul>
					<li><a href="#">Supai Walkthrough</a></li>
					<li><a href="#">The Drive</a></li>
					<li><a href="http://www.example.com/p/adventures.html#HTP">Hilltop</a></li>
					<li><a href="http://www.example.com/p/adventures.html#TRK">VillageTrek</a></li>
					<li><a href="http://www.example.com/p/adventures.html#VLG">Village</a></li>
					<li><a href="http://www.example.com/p/adventures.html#NJF">Navajo Falls</a></li>
					<li><a href="http://www.example.com/p/adventures.html#HSF">Havasu Falls</a></li>
					<li><a href="http://www.example.com/p/adventures.html#CMP">Campground</a></li>
					<li><a href="http://www.example.com/p/adventures.html#MNF">Mooney Falls</a></li>
					<li><a href="http://www.example.com/p/adventures.html#BTK">Beaver Trek</a></li>
					<li><a href="http://www.example.com/p/adventures.html#BVF">Beaver Falls</a></li>
					<li><a href="http://www.example.com/p/adventures.html#CTK">Colorado River Trek</a></li>
					<li><a href="http://www.example.com/p/adventures.html#CRV">Colorado River</a></li>
				</ul>
			<li><a href="http://www.example.com/p/adventures.html#NSW">Never Summer Wilderness</a></li>
			<li><a href="http://www.example.com/p/adventures.html#RRG">Red River Gorge</a></li>
			<li><a href="http://www.example.com/p/adventures.html#YEL">Yellowstone</a></li>
			<li><a href="http://www.example.com/p/adventures.html#SNP">Sequoia Nat'l Park</a></li>
		</ul>
	<li><a href="http://www.example.com/p/contest.html">Contest</a></li>
	<li><a href="http://www.example.com/p/fire.html">Fire Basics</a>
</li></li></ul>
</div>

</!doctype>

3 个答案:

答案 0 :(得分:1)

每个子菜单axis必须位于更高级菜单的x = np.arange(2,10,2) y = x.copy() x_ticks_labels = ['jan','feb','mar','apr','may'] fig, ax = plt.subplots(1,1) ax.plot(x,y) # Set number of ticks for x-axis ax.set_xticks(x) # Set ticks labels for x-axis ax.set_xticklabels(x_ticks_labels, rotation='vertical', fontsize=18) 元素的里面,所以这段代码......

ul

......应该是

li

(移动关闭<li><a href="http://www.journeysofthecrew.com/p/adventures.html#SUP">Supai</a></li> <ul> <li><a href="#">Supai Walkthrough</a></li> <li><a href="#">The Drive</a></li> [ etc. ] <li><a href="http://www.journeysofthecrew.com/p/adventures.html#CRV">Colorado River</a></li> </ul> 代码)

答案 1 :(得分:0)

将子子菜单(包含在另一个ul标签中)放在list标签和样式中,如下所示:

#cssnav ul li:hover #cssnav ul li ul li{
  left:100%;
  overflow:visible;
  top: 0px;
margin: 0px;
left: 100%;
}
#cssnav ul li ul:hover {
  visibility:visible;
  overflow:visible;
}

click here for demo

答案 2 :(得分:0)

$("#cssmenu").menumaker({
    title: "Menu",
    breakpoint: 768,
    format: "multitoggle"
});
@import url(https://fonts.googleapis.com/css?family=Montserrat:400,700);
#cssmenu,
#cssmenu ul,
#cssmenu ul li,
#cssmenu ul li a,
#cssmenu #menu-button {
  margin: 0;
  padding: 0;
  border: 0;
  list-style: none;
  line-height: 1;
  display: block;
  position: relative;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}
#cssmenu:after,
#cssmenu > ul:after {
  content: ".";
  display: block;
  clear: both;
  visibility: hidden;
  line-height: 0;
  height: 0;
}
#cssmenu #menu-button {
  display: none;
}
#cssmenu {
  font-family: Montserrat, sans-serif;
  background: #3b3f41;
}
#cssmenu > ul > li {
  float: left;
}
#cssmenu.align-center > ul {
  font-size: 0;
  text-align: center;
}
#cssmenu.align-center > ul > li {
  display: inline-block;
  float: none;
}
#cssmenu.align-center ul ul {
  text-align: left;
}
#cssmenu.align-right > ul > li {
  float: right;
}
#cssmenu > ul > li > a {
  padding: 17px;
  font-size: 12px;
  letter-spacing: 1px;
  text-decoration: none;
  color: #ef547b;
  font-weight: 700;
  text-transform: uppercase;
}
#cssmenu > ul > li:hover > a {
  color: #cccccc;
}
#cssmenu > ul > li.has-sub > a {
  padding-right: 30px;
}
#cssmenu > ul > li.has-sub > a:after {
  position: absolute;
  top: 22px;
  right: 11px;
  width: 8px;
  height: 2px;
  display: block;
  background: #ef547b;
  content: '';
}
#cssmenu > ul > li.has-sub > a:before {
  position: absolute;
  top: 19px;
  right: 14px;
  display: block;
  width: 2px;
  height: 8px;
  background: #ef547b;
  content: '';
  -webkit-transition: all .25s ease;
  -moz-transition: all .25s ease;
  -ms-transition: all .25s ease;
  -o-transition: all .25s ease;
  transition: all .25s ease;
}
#cssmenu > ul > li.has-sub:hover > a:before {
  top: 23px;
  height: 0;
}
#cssmenu ul ul {
  position: absolute;
  left: -9999px;
}
#cssmenu.align-right ul ul {
  text-align: right;
}
#cssmenu ul ul li {
  height: 0;
  -webkit-transition: all .25s ease;
  -moz-transition: all .25s ease;
  -ms-transition: all .25s ease;
  -o-transition: all .25s ease;
  transition: all .25s ease;
}
#cssmenu li:hover > ul {
  left: auto;
}
#cssmenu.align-right li:hover > ul {
  left: auto;
  right: 0;
}
#cssmenu li:hover > ul > li {
  height: 35px;
}
#cssmenu ul ul ul {
  margin-left: 100%;
  top: 0;
}
#cssmenu.align-right ul ul ul {
  margin-left: 0;
  margin-right: 100%;
}
#cssmenu ul ul li a {
  border-bottom: 1px solid rgba(150, 150, 150, 0.15);
  padding: 11px 15px;
  width: 170px;
  font-size: 12px;
  text-decoration: none;
  color: #dddddd;
  font-weight: 400;
  background: #333333;
}
#cssmenu ul ul li:last-child > a,
#cssmenu ul ul li.last-item > a {
  border-bottom: 0;
}
#cssmenu ul ul li:hover > a,
#cssmenu ul ul li a:hover {
  color: #99cdf5;
}
#cssmenu ul ul li.has-sub > a:after {
  position: absolute;
  top: 16px;
  right: 11px;
  width: 8px;
  height: 2px;
  display: block;
  background: #dddddd;
  content: '';
}
#cssmenu.align-right ul ul li.has-sub > a:after {
  right: auto;
  left: 11px;
}
#cssmenu ul ul li.has-sub > a:before {
  position: absolute;
  top: 13px;
  right: 14px;
  display: block;
  width: 2px;
  height: 8px;
  background: #dddddd;
  content: '';
  -webkit-transition: all .25s ease;
  -moz-transition: all .25s ease;
  -ms-transition: all .25s ease;
  -o-transition: all .25s ease;
  transition: all .25s ease;
}
#cssmenu.align-right ul ul li.has-sub > a:before {
  right: auto;
  left: 14px;
}
#cssmenu ul ul > li.has-sub:hover > a:before {
  top: 17px;
  height: 0;
}
#cssmenu.small-screen {
  width: 100%;
}
#cssmenu.small-screen ul {
  width: 100%;
  display: none;
}
#cssmenu.small-screen.align-center > ul {
  text-align: left;
}
#cssmenu.small-screen ul li {
  width: 100%;
  border-top: 1px solid rgba(120, 120, 120, 0.2);
}
#cssmenu.small-screen ul ul li,
#cssmenu.small-screen li:hover > ul > li {
  height: auto;
}
#cssmenu.small-screen ul li a,
#cssmenu.small-screen ul ul li a {
  width: 100%;
  border-bottom: 0;
}
#cssmenu.small-screen > ul > li {
  float: none;
}
#cssmenu.small-screen ul ul li a {
  padding-left: 25px;
}
#cssmenu.small-screen ul ul ul li a {
  padding-left: 35px;
}
#cssmenu.small-screen ul ul li a {
  color: #ef547b;
  background: none;
}
#cssmenu.small-screen ul ul li:hover > a,
#cssmenu.small-screen ul ul li.active > a {
  color: #cccccc;
}
#cssmenu.small-screen ul ul,
#cssmenu.small-screen ul ul ul,
#cssmenu.small-screen.align-right ul ul {
  position: relative;
  left: 0;
  width: 100%;
  margin: 0;
  text-align: left;
}
#cssmenu.small-screen > ul > li.has-sub > a:after,
#cssmenu.small-screen > ul > li.has-sub > a:before,
#cssmenu.small-screen ul ul > li.has-sub > a:after,
#cssmenu.small-screen ul ul > li.has-sub > a:before {
  display: none;
}
#cssmenu.small-screen #menu-button {
  display: block;
  padding: 17px;
  color: #ef547b;
  cursor: pointer;
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 700;
}
#cssmenu.small-screen #menu-button:after {
  position: absolute;
  top: 22px;
  right: 17px;
  display: block;
  height: 4px;
  width: 20px;
  border-top: 2px solid #ef547b;
  border-bottom: 2px solid #ef547b;
  content: '';
  box-sizing: content-box;
}
#cssmenu.small-screen #menu-button:before {
  position: absolute;
  top: 16px;
  right: 17px;
  display: block;
  height: 2px;
  width: 20px;
  background: #ef547b;
  content: '';
  box-sizing: content-box;
}
#cssmenu.small-screen #menu-button.menu-opened:after {
  top: 23px;
  border: 0;
  height: 2px;
  width: 15px;
  background: #cccccc;
  -webkit-transform: rotate(45deg);
  -moz-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  -o-transform: rotate(45deg);
  transform: rotate(45deg);
}
#cssmenu.small-screen #menu-button.menu-opened:before {
  top: 23px;
  background: #cccccc;
  width: 15px;
  -webkit-transform: rotate(-45deg);
  -moz-transform: rotate(-45deg);
  -ms-transform: rotate(-45deg);
  -o-transform: rotate(-45deg);
  transform: rotate(-45deg);
}
#cssmenu.small-screen .submenu-button {
  position: absolute;
  z-index: 99;
  right: 0;
  top: 0;
  display: block;
  border-left: 1px solid rgba(120, 120, 120, 0.2);
  height: 46px;
  width: 46px;
  cursor: pointer;
}
#cssmenu.small-screen .submenu-button.submenu-opened {
  background: #2f3234;
}
#cssmenu.small-screen ul ul .submenu-button {
  height: 34px;
  width: 34px;
}
#cssmenu.small-screen .submenu-button:after {
  position: absolute;
  top: 22px;
  right: 19px;
  width: 8px;
  height: 2px;
  display: block;
  background: #ef547b;
  content: '';
}
#cssmenu.small-screen ul ul .submenu-button:after {
  top: 15px;
  right: 13px;
}
#cssmenu.small-screen .submenu-button.submenu-opened:after {
  background: #cccccc;
}
#cssmenu.small-screen .submenu-button:before {
  position: absolute;
  top: 19px;
  right: 22px;
  display: block;
  width: 2px;
  height: 8px;
  background: #ef547b;
  content: '';
}
#cssmenu.small-screen ul ul .submenu-button:before {
  top: 12px;
  right: 16px;
}
#cssmenu.small-screen .submenu-button.submenu-opened:before {
  display: none;
}
#cssmenu.small-screen.select-list {
  padding: 5px;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- jQuery -->
<script src="http://code.jquery.com/jquery-latest.min.js"></script>

<!-- MenuMaker Plugin -->
<script src="https://s3.amazonaws.com/menumaker/menumaker.min.js"></script>

<!-- Icon Library -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<meta charset="UTF-8">
<title>Title</title>
</head>

<body>
<div id="cssmenu">
  <ul>
     <li><a href="#" target="_blank"><i class="fa fa-fw fa-home"></i> Home</a></li>
     <li><a href="#">About me</a></li>
     <li><a href="#">JOC: Book Series</a></li>
     <li><a href="#"><i class="fa fa-fw fa-cog"></i> Adventures</a>
        <ul>
           <li><a href="#">Supai</a>
              <ul>
                 <li><a href="#">Supai Walkthrough</a></li>
                 <li><a href="#">The Drive</a></li>
                 <li><a href="#">Hilltop</a></li>
                 <li><a href="#">VillageTrek</a></li>
                 <li><a href="#">Village</a></li>
                 <li><a href="#">Navajo Falls</a></li>
                 <li><a href="#">Havasu Falls</a></li>
                 <li><a href="#">Campground</a></li>
                 <li><a href="#">Mooney Falls</a></li>
                 <li><a href="#">Beaver Trek</a></li>
                 <li><a href="#">Beaver Falls</a></li>
                 <li><a href="#">Colorado River Trek</a></li>
                 <li><a href="#">Colorado River</a></li>
              </ul>
           </li>
           <li><a href="#">Never Summer Wilderness</a></li>
           <li><a href="#">Red River Gorge</a></li>
           <li><a href="#">Yellowstone</a></li>
           <li><a href="#">Sequoia Nat'l Park</a></li>
        </ul>
     </li>
     <li><a href="#">Contest</a></li>
     <li><a href="#">Fire Basics</a></li>
  </ul>
</div>
</body>

</html>