[英]Centering asp:menu item's when there are multiple rows of menu items
you can replicate my problem with this small code snippet. 您可以使用此小代码段来复制我的问题。
<div ID="topcell" runat="server" align="center" style="text-align:center">
<asp:Menu ID="testmenu" runat="server" Width="300px" Orientation="Horizontal" RenderingMode="List">
<Items>
<asp:MenuItem Text="Testing"></asp:MenuItem>
<asp:MenuItem Text="Testing"></asp:MenuItem>
<asp:MenuItem Text="Testing"></asp:MenuItem>
<asp:MenuItem Text="Testing"></asp:MenuItem>
<asp:MenuItem Text="Testing"></asp:MenuItem>
<asp:MenuItem Text="Testing"></asp:MenuItem>
</Items>
</asp:Menu>
</div>
Result: 结果:
Desired results: 所需结果:
I have tried all three RenderingModes with no luck! 我没有运气就尝试了所有三种RenderingModes! Am I doing something wrong guys? 我在做错事吗?
Thanks in advanced. 提前致谢。
Try adding following CSS to your page: 尝试在页面上添加以下CSS:
<style type="text/css" >
#testmenu ul li {
display:inline-block;
float:none !important;
}
</style>
It will overwrite inline menu styles and force the unordered list to center. 它将覆盖嵌入式菜单样式,并强制无序列表居中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.