如何拆分导航并浮动到每一侧?

时间:2015-11-14 00:59:13

标签: html css navigation

我希望能够将我的导航标题分割为3/3,将一组设置为左侧,一组设置为右侧,但仍然将子项直接放在父级下方。我一直在苦苦挣扎。感谢您的帮助,如果我可以添加任何内容,请告诉我们!



ul {
  list-style: none;
  color: white;
}
ul a {
  color: #fff;
}
left ul li {
  position: relative;
}
ul,
li {
  margin: 0;
  padding: 0;
}
li {
  display: inline-block;
  padding: 10px 10px;
}
ul li ul {
  display: none;
  position: absolute;
  top: 45px;
  left: 0;
}
ul li ul li {
  display: block;
}
ul li:hover {
  color: black;
  text-shadow: none;
}
ul li:hover ul {
  display: block;
}

<div id="nav">
  <ul>
    <li><a href="#">Home</a>
    </li>
    <li><a>Be Inspired</a>
      <ul>
        <li><a href="#">Bel Marin Keys</a>
        </li>
        <li><a href="#">Belvedere</a>
        </li>
        <li><a href="#">Tiburon</a>
        </li>
        <li><a href="#">San Francisco</a>
        </li>
        <li><a href="#">San Rafael</a>
        </li>
        <li><a href="#">Piedmont</a>
        </li>
      </ul>
    </li>
    <li><a>Services</a>
      <ul>
        <li><a href="#">Planting</a>
        </li>
        <li><a href="#">Custom Stonework</a>
        </li>
        <li><a href="#">Carpentry</a>
        </li>
        <li><a href="#">Outdoor Lighting</a>
        </li>
        <li><a href="#">Irrigation</a>
        </li>
        <li><a href="#">Maintenance</a>
        </li>
      </ul>
    </li>
    <li><a href="#">Advice &#038; News</a>
    </li>
    <li><a href="#">About Us</a>
      <ul>
        <li><a href="#">Staff</a>
        </li>
        <li><a href="#">Careers</a>
        </li>
      </ul>
    </li>
    <li><a href="#">Contact Us</a>
    </li>
  </ul>
</div>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

这样的东西?

.superflex{display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-flex-wrap: nowrap;
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
-webkit-justify-content: space-between;
-ms-flex-pack: justify;
justify-content: space-between;
-webkit-align-content: stretch;
-ms-flex-line-pack: stretch;
align-content: stretch;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;}

http://codepen.io/damianocel/pen/RWEVPW