Solved

asp.net menu

Posted on 2011-09-20
4
209 Views
Last Modified: 2012-05-12
Hello,

I have built a basic page layout and am trying to get create a basic menubar using the built in menu function in ASP.NET.  I am working in Visual Studio 2010 with .NET 4.0 as the target framework.  

I am trying to make the asp menu fit to the very top of my div "menu".  When displayed in Firefox, there is no gap between the top of "menu" and the start of "Menu1".  When displayed in IE, there is a significant gap, I'd guess 10 pixels.

I created a brand new page with just this code, to be sure nothing else was causing it.

Any suggestions, I've set all the paddings to 0px, so I'm thinking I must be missing a property somewhere.  

Thanks  
<div id="menu">
            
			<asp:Menu ID="Menu1" runat="server" 
Orientation="Horizontal" 
                BorderStyle="None"  >
                <Items>
                  ...
                </Items>
            
            
                <StaticMenuItemStyle ForeColor="White" HorizontalPadding="0px" 
                    VerticalPadding="0px" />
                <StaticMenuStyle BackColor="Lime" />
            
            
            </asp:Menu>
</div>

#menu
{
    clear: both;
    font-size: 10px;
    background-image: url(Images/menu.png);
    background-repeat: repeat-x;
    height: 28px;
    vertical-align: top;
    color: #FFFFFF;
    padding: 0px 0px 0px 0px;
}

Open in new window

0
Comment
Question by:compsol1993
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 38

Accepted Solution

by:
Tom Beck earned 350 total points
ID: 36570288
All browsers apply some default padding and margins to their page layouts. Just as a test you could try adding something like this to the top of your css definitions:

* {padding:0; margin-top:0}

It could mess up the layout of some other items on the page, but at least you will know it's default padding or margins causing the problem.
0
 
LVL 38

Expert Comment

by:Tom Beck
ID: 36570305
Or maybe this would be a more thorough test:

* {padding:0; margin:0}
0
 
LVL 41

Assisted Solution

by:guru_sami
guru_sami earned 150 total points
ID: 36577059
Any sample code we can see this in action / reproduce?
Not sure if this has anything to do with it.
0
 

Author Closing Comment

by:compsol1993
ID: 36599134
Thanks guys, this pointed me in the right direction.  I figured out the cause.

ASP.net when rendered, builds the menu with <ul> & <li>'s.  My CSS was handling other list elements, and inadvertently messed up the menu.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question