Solved

asp.net menu

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Hidden Field Value 10 60
Asp.net mvc 5 5 43
Problem to page 4 71
ADO.NET ENTITY DATA MODEL 3 30
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
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:
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

911 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now