[英]ASP Menu float property is not working
I have an asp menu, I want to float it to left so the element after it can come to its right side (beside) it. 我有一个asp菜单,我想将其浮动到左侧,以便其后的元素可以到达其右侧(旁边)。 I've set a
CssClass
for the Menu
and added float: left
to it, but it is not working. 我已经为
Menu
设置了一个CssClass
并添加了float: left
它,但是它不起作用。 I've even changed the float:left
to float:right
to see if it will work or not, but nothing worked. 我什至将
float:left
更改为float:right
来查看它是否可以工作,但是什么也没有。
Here is my code: 这是我的代码:
<form id="form1" runat="server">
<div class="wrapper">
<div class="navbar">
/*some code*/
</div>
<div class="middle">
<asp:Menu ID="MenuRec" runat="server" CssClass="recFriends">
<Items>
<asp:MenuItem Text="People you may know:" Selectable="false" Enabled="false"></asp:MenuItem>
<asp:MenuItem Text="<br/>" Selectable="false" Enabled="false"></asp:MenuItem>
</Items>
<Items>
<asp:MenuItem Text=" Item1" Selectable="false"></asp:MenuItem>
<asp:MenuItem Text=" Item2" Selectable="false"></asp:MenuItem>
<asp:MenuItem Text=" Item3" Selectable="false"></asp:MenuItem>
</Items>
</asp:Menu>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
<!--here goes the customized content-->
</asp:ContentPlaceHolder>
</div>
<div class="footer">
</div>
</div>
</form>
</body>
My CSS: 我的CSS:
.recFriends {
float:left;
padding-top:1em;
color:#003366;
font-weight:normal;
font-style:italic;
}
controls inside the ContentPlaceHolder
(which will be in a page that inherits from this master page) must come to the right of the menu, but these are coming below it instead. ContentPlaceHolder
内部的控件(将在从该母版页继承的页面中)必须位于菜单的右侧,但这些控件位于菜单的下方。
I've searched a lot, but nothing worked, I've even checked the solutions available here: 我进行了很多搜索,但没有任何效果,甚至检查了以下可用的解决方案:
CssClass is not working for my asp menu - all code attached CssClass不适用于我的asp菜单-附加所有代码
asp Menu control not floating properly ASP菜单控件未正确浮动
Can anyone tell me how to solve this problem? 谁能告诉我如何解决这个问题?
Thank you. 谢谢。
Wrap your menu in a div and close the div before the content place holder. 将菜单包裹在div中,然后在内容占位符之前关闭div。 Move your CSS class from the menu to the container div.
将CSS类从菜单移至容器div。
HTML 的HTML
<div class="recFriends">
<asp:Menu ID="MenuRec" runat="server">
<Items>
<asp:MenuItem Text="People you may know:" Selectable="false" Enabled="false"></asp:MenuItem>
<asp:MenuItem Text="<br/>" Selectable="false" Enabled="false"></asp:MenuItem>
</Items>
<Items>
<asp:MenuItem Text=" Item1" Selectable="false"></asp:MenuItem>
<asp:MenuItem Text=" Item2" Selectable="false"></asp:MenuItem>
<asp:MenuItem Text=" Item3" Selectable="false"></asp:MenuItem>
</Items>
</asp:Menu>
</div>
<asp:ContentPlaceHolder ID="MainContent" runat="server">
<!--here goes the customized content-->
</asp:ContentPlaceHolder>
CSS 的CSS
.recFriends {
float: left;
padding-top: 1em;
color: #003366;
font-weight: normal;
font-style: italic;
width: 20%;
padding-left: 2em;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.