Solved

CSS Menu Breaks with Browser Zoom Less than 100%

Posted on 2010-08-30
6
1,145 Views
Last Modified: 2012-05-10
Hey All!

I've seen similar questions to this asked on EE, but I can't seem to find a solution for my particular situation. I wondered if a CSS expert could give me some advice. I have a navigation bar that breaks when the zoom of the browser is less than 100%. The last link in my menu falls to the second line. You can see an example here:

http://dzinentertainment.com/test/

Contact falls beneath the menu if the zoom is less than 100%. From what I can tell, this happens in IE8 and Firefox.  Might anyone have any thoughts on this? I'm pasting the CSS for the menu below.

I would appreciate anyone's thoughts!!
#nav-bar {height:27px;width:6px;display:inline;float:right;padding:0;margin:-15px 0 0 0;}

#menu {width:670px; max-width:670px;height:27px;background:url(images/nav-bar-mid.jpg) repeat-x;display:inline;float:right;padding:0;margin:-15px 0 0 0;position:relative;z-index:999;}



#menu ul {margin: 0;padding: 0;list-style: none;float: left;}

#menu ul.menu {padding-left:5px;}



#menu li {position: relative;z-index: 9;margin: 0;padding: 0 15px 0 10px;display: block;float: left;}

#menu li:hover>ul {left: -2px;}



#menu a {position: relative;z-index: 10;height: 27px;display: block;float: left;line-height: 27px;text-decoration: none;font-size:12px;font-weight:bold;font-family:"Trebuchet MS", Arial, sans-serif;}

#menu a:hover, #menu a:hover span { color: #2d2d2d;}

#menu li.current a {}



#menu span {display: block;cursor: pointer;background-repeat: no-repeat;background-position: 95% 0;}

#menu ul ul a.parent span {background-position:95% 8px;background-image: url(images/item-pointer.gif);}

#menu ul ul a.parent:hover span {background-image: url(images/item-pointer-mover.gif);}



/* menu::level1 */

#menu a {padding: 0 12px 0 12px;line-height:28px;color:#fff;}

#menu span {margin-top: -1px;}

#menu li { background: url(images/main-delimiter.png) 98% 0px no-repeat; }

#menu li.arrow { background: url(images/parent-delimiter-trans.png) 100% 0px no-repeat;}

#menu li.last { background: none; }



/* menu::level2 */

#menu ul ul li { background: none;width:100%}

#menu ul ul {position: absolute;top: 26px;padding: 0;margin-top:1px;display:none;}

#menu ul ul a {padding:0;height: auto;float: none;line-height: 11px;color: #2d2d2d;}

#menu ul ul span {margin: 0;color: #2d2d2d;white-space: nowrap;display: block;background: #8f969e;padding:20px 0 0 25px;}

#menu ul ul span.bottom {padding-bottom:20px;}

#menu ul ul a:hover span {color: #fff;}

#menu ul ul li.last { background: none; }

Open in new window

0
Comment
Question by:azlumiere
6 Comments
 
LVL 10

Expert Comment

by:TiberiuGal
ID: 33559040
Hi,
if you change your padding-right for #menu a to 11px it won't do it anymore

cheers



0
 

Author Comment

by:azlumiere
ID: 33559217
Hey TiberiuGal,

Thanks so much for the comment. I tried your suggestion (and even tried it in a few different spots), but it didn't seem to affect anything. I put add it to line #10 in the CSS above. Is that what you were thinking?

Thanks!
0
 
LVL 30

Expert Comment

by:LZ1
ID: 33560943
Have you tried adjusting the width of the #menu. If you put it at 690px you should be ok.  I would personally then just adjust the image or paddings to line it up after that.  But 690 seemed like a good starting point
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:azlumiere
ID: 33562424
Hi LZ1,

Thank you for your comment. I may need to keep experimenting.... I don't really want to change the width of #menu because it includes a background, so it physically increases the size of the navigation bar, and that's not what I want. What I may have to do is keep tweaking the left and right padding I suppose.
0
 
LVL 4

Accepted Solution

by:
Morrisproject earned 125 total points
ID: 33563057
Ok.

Here is a fix :
Style.css
line 165
Remove the padding-left for the menu, as it will actually make it more align anyway.

line 183
Then add this to line:
padding-right:0;

That should sort it, I made those changes and tested and seems ok. Browser zooms are always a pain had the same issue with a menu of mine recently.
0
 

Author Closing Comment

by:azlumiere
ID: 33564003
Morrisproject:

Thanks so much for taking the time to share your experience. This solution worked the best. When I tested with IE 8 contact still fell below at 75%, but I made a small padding change to the IE8 styles and I think it will work. You're definitely right that browser zooms are the pits!

Thanks again! :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
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…

895 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

13 Experts available now in Live!

Get 1:1 Help Now