Question by No Boundaries: Need some CSS/ XHTML help?
I’m trying to make a navigation bar at the top of my page
But the text keeps wrapping in my smaller monitors and minimized windows
The nowrap CSS isn’t doing anything
I haven’t added anything to the page, just the nav bar
GAH please help
HTML Here:
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
content="text/html;charset=utf-8" />
CSS here:
body {
background-color: black;
}
* {
margin: 0;
padding: 0;
}
ul {
list-style-type: none;
background-image: url(images/title_blue.png);
background-repeat: repeat-x;
background-position: top;
font-family: Arial, Tahoma, sans-serif;
font-size: 0.8em;
background-color: black;
color: #94B0D8;
min-width: 994px;
min-height: 220px;
}
li {
float: left;
}
ul a {
margin-left: 32px;
line-height: 32px;
margin-top: 140px;
margin-right:20px;
background-image: url(images/title_blue.png);
background-repeat: no-repeat;
background-position: right;
padding-right: 55px;
padding-left: 20px;
display: block;
line-height: 80px;
text-decoration: none;
font-family: Georgia, “Times New Roman”, Times, serif;
font-size: 20px;
color: #4682B4;
}
ul a:hover {
color: #FFF;
}
Best answer:
Answer by Poki
Hi. I think the issue is in your css code.
by the ul a {…
padding-right: 55px;
padding-left: 20px;
There’s too much padding. Maybe you should delete these 2 lines:
padding-right: 55px;
padding-left: 20px;
Give your answer to this question below!




You’ve set the min-width of
to 994px but you haven’t set the width property, so the content can expand beyond 994px — if you set your width to 994px, then the width would be fixed at 994px regardless of window size.- ) are wrapping because they have float applied. If you don’t want them to wrap, easiest thing is to just set the width of the
What’s probably happening is that your browser window is at a width greater than 994px, so you’re seeing the content expand beyond 994px, and when you resize your window smaller, the list elements (
to 994px (or whatever you deem appropriate). Note that at 994px with your current font and padding settings, the list will wrap.
As Poki pointed out, you’re using a lot of padding, so decreasing that can mitigate the problem.