473,505 Members | 15,212 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Horizontal Navigation bar and fixed width

Hmmm, have now spent a day reading the entire web with no answer yet! so now
resorting again to the experts...

I'm trying to create a horizontal list. This is easy enough doing:

<html>
<head>
<style type="text/css">
#legend ul {
white-space: nowrap;
}

#legend li {
display: inline;
border: 1px solid black;
}
</style>
</head>
<body>

<ul id="legend">
<li>some data </li> <!-- MUST have trailing spaces to remove "gap" in
NS -->
<li>some more data, a bit longer </li>
<li>short </li>
</ul>
</body>
</html>

My problem is that I would like to have each element the same width. So
naturally, I modify the li style as:

#legend li {
display: inline;
border: 1px solid black;
width: 10em;
}

That works fine for IE6. But Netscape/Mozilla do not respect the width rule.
I can understand why as the li item is now inline hence width doesn't make
sense. But I'd still like to achieve the effect. I know I could pad out my
next with &nbsp; but that is a kludge and only marginal at best (a guessing
game on font sizes, etc). I also don't have the luxury of creating fixed
sized images.

So am I missing something? Or is this simply not officially supported and IE
is just being nice?

regards,
-randall
Jul 20 '05 #1
2 11256
Randall Sell wrote:

[snip]
My problem is that I would like to have each element the same width. So
naturally, I modify the li style as:

#legend li {
display: inline;
border: 1px solid black;
width: 10em;
}

That works fine for IE6. But Netscape/Mozilla do not respect the width
rule. I can understand why as the li item is now inline hence width
doesn't make sense.
Yes, that's right.

<URL:http://www.w3.org/TR/REC-CSS2/visudet.html#propdef-width>

But I'd still like to achieve the effect.
#legend li {
display: block;
width: 10em;
float: left;
}
[snip] So am I missing something? Or is this simply not officially supported and
IE is just being nice?


Only if you consider ignoring the specification "being nice".

"[The 'width' property] Applies to: all elements but non-replaced inline
elements, table rows, and row groups"

"The width of a non-replaced inline element's boxes is that of the rendered
content within them"

That seems pretty clear to me.

--
Jim Dabell

Jul 20 '05 #2

"Jim Dabell" <ji********@jimdabell.com> wrote in message
news:XK********************@giganews.com...
Randall Sell wrote:

[snip]
My problem is that I would like to have each element the same width. So
naturally, I modify the li style as:

#legend li {
display: inline;
border: 1px solid black;
width: 10em;
}

That works fine for IE6. But Netscape/Mozilla do not respect the width
rule. I can understand why as the li item is now inline hence width
doesn't make sense.
Yes, that's right.

<URL:http://www.w3.org/TR/REC-CSS2/visudet.html#propdef-width>

But I'd still like to achieve the effect.


#legend li {
display: block;
width: 10em;
float: left;
}
[snip]
So am I missing something? Or is this simply not officially supported and IE is just being nice?


Only if you consider ignoring the specification "being nice".

"[The 'width' property] Applies to: all elements but non-replaced inline
elements, table rows, and row groups"

"The width of a non-replaced inline element's boxes is that of the

rendered content within them"

That seems pretty clear to me.

--
Jim Dabell

Indeed, it is crystal clear when you find the reference. thanx
-randall
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
4891
by: Roderik | last post by:
Hi, At http://archytas.nl/ there appears to be a horizontal scrollbar when using Mozilla Firebird (not in IE). The website (container DIV) should be 770 px wide, so there shouldn't be any reason...
16
3419
by: Vincent | last post by:
First, here is a page to help you figure out what I'm talking about: http://relinquiere.free.fr/test.html As you can see in the source of this page, the structure is the following : - a banner...
1
5963
by: Bryan | last post by:
I've been trying to figure out how to do this for the past 2 days and am finally tossing in the towel. No matter what I do, I just can't seem to get it to work and haven't been able to find any...
3
6916
by: dan | last post by:
Hi folks, I have a very simple requirement - I want to have a row of divs of fixed size (but unknown number of them) This will be in a container div and scrolled by other means Is there any...
0
1680
by: thulsey | last post by:
Hi all, I've got some strange behavior happening in Firefox and Safari (Khtml and Gecko) that displays *almost* fine in IE6.0 (still trying to get pixels to line up, anal anal anal...) To...
14
5393
by: Dave | last post by:
My web site is not particularly theme-based, but it contains an Art Gallery I'd like to display in a different perspective. I would like to horizontally scroll it, rather than vertically - as if...
2
2666
by: Benny Raymond | last post by:
Does anyone know what causes a treeview to sometimes start with a horizontal scrollbar that has no reason to be there, and will not go away until you size into the nodes and then back out? ...
1
3451
by: Paul | last post by:
Code is below. Works in Firefox but not IE. I understand there is a box issue with IE but I am having problems fixing this. Many thanks for any help! #navigation { float: left; width: 125px;...
5
1963
by: Awok | last post by:
Hi, i've been stuck trying to get the following code to display correctly in IE in which i've come across many diffrent theories but none which have worked possibly the box model problem. ...
0
7216
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7303
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7367
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7018
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5613
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4699
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1528
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
407
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.