我有一个带有几个li标签的导航栏,当在较小的屏幕尺寸时,它们会相互重叠。我希望导航栏保持相同的高度,并在较小的设备屏幕上水平滚动,但我尝试的所有操作均不起作用。有人可以照亮这里出了什么问题吗!
HMTL:
<nav role="navigation" class="site-navigation main-navigation">
<div class="menu">
<ul>
<li class="page_item page-item-40"><a href="http://localhost/property_abba/for-sale/">Buy</a></li>
<li class="page_item page-item-41"><a href="http://localhost/property_abba/for-rent/">Rent</a></li>
<li class="page_item page-item-7"><a href="http://localhost/property_abba/sell/">Sell</a></li>
<li class="page_item page-item-9 current_page_item"><a href="http://localhost/property_abba/valuations/">Valuations</a></li>
<li class="page_item page-item-15"><a href="http://localhost/property_abba/property-management/">Property Management</a></li>
<li class="page_item page-item-11"><a href="http://localhost/property_abba/about-us/">About Us</a></li>
<li class="page_item page-item-13"><a href="http://localhost/property_abba/contact-us/">Contact Us</a></li>
</ul>
</div>
</nav>
CSS:
@media screen and (max-width : 480px){
div.menu ul {
display: inline-block;
max-height: 34px;
overflow: auto;
white-space: nowrap;
}
div.menu a {
display: inline-block;
text-align: center;
}
}
但这目前不起作用。
最佳答案
水平滚动菜单移动
关于html - 如何使导航菜单栏水平滚动,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/43820007/