Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

asp.net menu

Posted on 2011-09-20
4
Medium Priority
?
216 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 1400 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 600 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
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…
The viewer will learn how to count occurrences of each item in an array.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

636 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