Vertical navigation with fluid horizontal sub menu

强颜欢笑 提交于 2020-01-16 20:05:56

问题


I'd like to build a vertical navigation. It's a bit special because the sub navigation should be displayed right next to the main links and should be fluid like this:

 Item 1 
 Item 2 | Subitem 1 | Subitem 2 | Subitem 3
 Subitem 4 | Subitem 5 | Subitem 6
 Item 3
 Item 4   Subitem 1 | Subitem 2 
 Item 5

I'm looking for a solution to make the sub menu fluid, so that the elements stays in the main menu row and breaks dynamically. How to break the sub list items like in the example above?

fiddle


回答1:


Is this what you're looking for? https://jsfiddle.net/u4zpdpg7/11/

ul > li > a {
    float: left;
    clear: both;
}

ul > li:hover > .sub-menu{
    display: block;
}

.sub-menu {
    display: none;
    float: left;
    padding-left: 10px;
}

.sub-menu li {
    float: left;
    padding-left: 10px;
}

.sub-menu li:first-child{
    border-left: 2px solid #333;
}


来源:https://stackoverflow.com/questions/29330616/vertical-navigation-with-fluid-horizontal-sub-menu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!