Question

I'm making a Vertical Navigation bar using Asp Menu. and I'm trying to set the Width to 100% but It remains as it is.

Here is the Code i'm using.

<div id="leftcolumn" >
<asp:Menu ID="Menu1" runat="server" CssClass="Menu" RenderingMode="List">
<Items>
<asp:MenuItem Text="Inbox" Value="inbox"></asp:MenuItem>
<asp:MenuItem Text="Processing"></asp:MenuItem>
<asp:MenuItem Text="aslkdjf"></asp:MenuItem>
<asp:MenuItem Text="aslkdjf"></asp:MenuItem>
<asp:MenuItem Text="aslkdjf"></asp:MenuItem>
</Items>
</asp:Menu>
</div>

Here is the CssClass for Div (leftcolumn)!

#leftcolumn{
float: left;
width: 200px; /*Width of left column*/
margin-left: -100%;
background: #C8FC98;}

Here is the Css Class for Menu

.Menu
{  
 font-family: 'Open Sans', sans-serif;
 font-size: 13px;
 width:auto;
}

.Menu ul
{  
list-style-type: none;
margin: 0;
padding: 0;
margin-bottom: 0; /*bottom spacing between each UL and rest of content*/
}

.Menu ul li
{
padding-bottom: 2px; /*bottom spacing between menu items*/

}

.Menu ul li a
{
color: black;
background: #E9E9E9;
display: block;
padding: 5px 0;
line-height: 17px;
padding-left: 8px; /*link text is indented 8px*/
text-decoration: none;
}

.Menu ul li a:hover
{
    background-image: none;
    color: white;
    background: black;
}

Here is the Menu.

Vertical Menu

I need to use the Asp:menu Control because I have to access the Control in the server side and make changes to it Dynamically.

Can you Help me?

Was it helpful?

Solution

Menu ul li
{
    width:150px !important;
    padding-bottom: 2px; /*bottom spacing between menu items*/
}

I Added The Width Property and Defined a fixed length to it. then my problem is solved.

OTHER TIPS

The following code may help you. I have checked the output with Firebug in Firefox

    #leftcolumn
    {
        float: left;
        width: 600px; /*Width of left column*/            
        background: #C8FC98;
    }

    .Menu
    {
        font-family: 'Open Sans' , sans-serif;
        font-size: 13px;
        width: 100%;
        float:left;
    }

    .Menu ul
    {
        list-style-type: none;
        margin: 0;
        padding: 0;
        margin-bottom: 0; /*bottom spacing between each UL and rest of content*/
        width:100% !important;
    }

    .Menu ul li
    {
        padding-bottom: 2px; /*bottom spacing between menu items*/
        float:left;
        line-height:40px;
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top