如何在汉堡包图标下面显示菜单列表?

时间:2016-07-12 11:43:11

标签: html css

如何在汉堡包图标下面显示菜单列表?

CSS:

@media screen and (max-width:680px) {
  ul.topnav.responsive {position: relative;}
  ul.topnav.responsive li.icon {
    position: absolute;
    right: 0;
    top: 0;
  }
  ul.topnav.responsive li {
    float: none;
    display: inline;
  }
  ul.topnav.responsive li a {
    display: block;
    text-align: left;
  }
  .container {
    width: auto;
  }
}

JSFiddle:https://jsfiddle.net/xkp0p7vc/

提前致谢。

1 个答案:

答案 0 :(得分:1)

只需将display: block; clear: both;添加到ul.topnav.responsive li,然后从float: right;删除.topnav-right

ul.topnav.responsive li {
    float: none;
    display: block; /*change with inline*/
    clear: both;
}

.topnav-right {
    /* float: right; */
}

Demo