How to make the absolute child width independent from the relative parent width?

前端 未结 2 1782
说谎
说谎 2021-01-13 03:00

I need to realize this menu with its submenu:

I set the main menu to be a ul/li with li float: left; display: b

相关标签:
2条回答
  • 2021-01-13 03:23

    Try this

    add one class as like this

    Css

    .submenu{display:inline-block;}
    

    your nav code

    <div class="main_menu_submenu">
    <ul class="submenu"> //---------------- Remove clearfix class and add submenu class this ul
    <li>
    <a href="/">La storia</a>
    </li>
    <li>
    <a href="/">Le persone</a>
    </li>
    </ul>
    </div>
    

    Demo

    0 讨论(0)
  • 2021-01-13 03:42

    Just delete the position:relative; of #main_menu li

    http://jsfiddle.net/STfGL/4/

    0 讨论(0)
提交回复
热议问题