asp Menu control not floating properly

2019-08-22 08:21发布

I'm trying to do this on my header:

Link | Link | Link                                               LoginStatus

But the Menu Control just won't float. What it does is like this:

Link | Link | Link
LoginStatus

I've tried floating it left but still doesn't work.

<div class="menucontainer">
                <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal" Style="float:left">
                    <Items>
                        <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Generate Report" 
                            Value="Generate Report"/>
                        <asp:MenuItem Selectable="False" Text="|"></asp:MenuItem>
                        <asp:MenuItem NavigateUrl="~/Download.aspx" Text="Mass Export" 
                            Value="Mass Export"></asp:MenuItem>
                        <asp:MenuItem Text="|"></asp:MenuItem>
                        <asp:MenuItem NavigateUrl="~/Admin/Home.aspx" Text="Login" 
                            Value="Login"></asp:MenuItem>
                    </Items>
                    <StaticMenuItemStyle BackColor="White" BorderColor="#CCCCCC" 
                        BorderWidth="1px" />
                </asp:Menu>
                <div style="float:left">asdaddas</div>
          </div>

CSS

div.menucontainer
{
    background-color:#465C71;
    border-bottom: 4px solid #465c71;
    margin: 0px 0px 0px 0px;
    width:100%;
    -moz-border-radius: 6px 6px 1px 1px;  /*FF1+ */
    -webkit-border-radius: 6px 6px 1px 1px; /* Saf3-4, iOS 1+, Android 1.5+ */
    border-radius: 4px 4px 1px 1px;/*  Opera 10.5, IE9, Saf5, Chrome, FF4 */
    clear:both;
}

div.menu
{
    padding: 4px 0px 0px 5px;
    font-size: 12px;
    float:left;
    width:auto;
    border-right: 20px solid red;
    clear:none;
}

2条回答
混吃等死
2楼-- · 2019-08-22 08:47

If you have the links working correctly with float:left, why not use float:right on your LoginStatus button (it's in its own div, from what I can tell).

查看更多
放荡不羁爱自由
3楼-- · 2019-08-22 08:56

just wrap your Menu Tag in a div and float that div.

<div id="OuterDiv">
  <div style="float: right;">
    <asp:Menu>
    </asp:Menu>
  </div>
  ....
</div>
查看更多
登录 后发表回答