Solved

asp.net menu

Posted on 2011-09-20
4
208 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
  • 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Footer for each row on Gridview 2 32
RLDC Reporting in Visual studio 11 29
Testing of the web services 1 32
How to use NFS (Network File System) in Asp.net mvc 5? 4 43
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

809 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