Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <ul id="nav">
    <li>
      <a href="#">Menu Item 1</a>
      <ul class="sub_menu">
        <!-- full of <li> sub menu items -->
      </ul>
    </li>
    <li>
      <a href="#">Menu Item 2</a>
      <ul class="sub_menu">
        <!-- full of <li> sub menu items -->
      </ul>
    </li>
    <li>
      <a href="#">Menu Item 3</a>
    </li>
  </ul>
</body>
</html>
 
* { margin: 0; padding: 0 }
#nav, .sub_menu {
  width: 100%;
  height: 30px;
  position: relative;
  background: green;
}
#nav > li > a {
  z-index: 1;
  position: relative;
}
#nav > li {
  float: left;
  list-style-type: none;
}
.sub_menu {
  position: absolute;
  left: 0;
  background: red;
  top: 30px
}
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers