Solved

CSS Menu Breaks with Browser Zoom Less than 100%

Posted on 2010-08-30
6
1,140 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

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.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

706 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