简体   繁体   中英

HTML Drop Down Menu : “nav ul ul ul li” Too Low

Here is an image :

图片 The problem is that (you can see) : the "Page" Button is too low, making it unable to be clicked. What I want is it should be near "Contact".

Now is the Code :

HTML

<nav>
  <ul>
    <li><a href="#">Home</a></li>
    <li><a href="#">About</a>
      <ul>
        <li><a href="#">Contact</a>
          <ul>
            <li><a href="#">Page</a></li>
          </ul>
        </li>
      </ul>
    </li>
  </ul>
</nav>

CSS

/* Basic Styling */

a {
  text-decoration:none;
  color:inherit;
}

/* Menu Styling */

nav > ul > li {
  display:inline-block;
  width:200px;
  height:50px;
  line-height:50px;
  margin:0px;
  padding:0px;
  background-color:#dddddd;
  text-align:center;

}

nav ul li:hover {
  background-color:#aaaaff;
}

nav ul ul {
    display:none;
    list-style:none;
    padding-left:0; 
}

nav ul li:hover > ul {
  display:block;
  position:relative;
}

nav ul li:hover > ul > li {
  display:inline-block;
  width:200px;
  height:50px;
  line-height:50px;
  padding:0px;
  margin:0px;
  text-align:center;
}

nav ul li {
  float: left;
}

nav ul ul li {
  margin:0px;
  padding:0px;
}

nav ul ul li:hover > ul {
  display: block;
  float: none;
  position: relative;
}

nav ul ul ul {
    position: absolute;
  left: 100%;
  top: 0;
}

nav ul ul li {
  position: relative;
  top:0;
}

There is no other problem but only this.
Check the jsfiddle : fiddle

See this demo: http://jqversion.com/#!/uMti6vc

I've changed the top property for ul ul ul elements

nav ul ul ul {
  position: absolute;
  left: 100%;
  top: -50px;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM