|
Posted by Ben C on February 9, 2008, 4:29 pm
Please log in for more thread options >> > On Feb 7, 11:03 am, DrPanic
>> >> Hello.
>>
>> >> I have a problem building an horizontal navlist.
>>
>> >> The technique i'm using is very simple: a list with inline LI
>> >> elements. It works fine but Mozilla render it with a gap between the
>> >> LI elements, I can't understand where that gap comes from.
[...]
>> But back to the OP's question, and leaving aside DOM methods, if you
>> write:
>>
>> <span>foo</span> <span>bar</span>
>>
>> a space should appear between "foo" and "bar". How can you possibly
>> consider that a bug?
>
> That is not OP's question.
I think it is. OP's source looked something like this:
<li>foo</li>
<li>bar</li>
In what you see above, in the source, there is the string '\n '
between the two list items. According to the white-space collapsing
rules (assuming white-space: normal) that all collapses down to one
space.
Now, if li is display: inline and has a thin border, you would expect to
see most of the space between the right border of the first <li> and the
left border of the second one.
That's the gap the OP was talking about.
> OP's question is answered at
> http://developer.mozilla.org/en/docs/Talk:Whitespace_in_the_DOM
> and I already posted this link.
OP wasn't asking about the DOM.
> It is also not my question: it is your own question which is
> irrelevant to the situation. I will answer it though if you answer
> mine.
I don't mind answering yours, although I'm not sure I've understood it.
><span>foo</span> <span>bar</span>
> Of course it must be not space removal inside a string, it would be as
> absurd as displaying on the screen "Loremipsumdolorsitamet" out of
> HTML source "<p>Lorem ipsum dolor sit amet</p>"
Indeed.
> Now let me repeat my question:
> Do you agree that HTML source like
><ul>
><li id="Item1">Item 1</li>
><li id="Item2">Item 2</li>
></ul>
> has to display an element 45px width and 21px height between the two
> LI elements?
Of course not. But I'm not sure I follow you. Where do you get this 45px
width and 21px element from? Why should the browser display any extra
elements?
> Other words do you agree that a line break in pretty- print must
> result in displayable elements of certain width and height?
The white-space, including newlines, between </li> and
<li> all collapses down to a single space.
Assuming we're still talking about the case where li is display: inline:
<li id="Item1">Item 1</li>
<li id="Item2">Item 2</li>
should display just the same as
<li id="Item1">Item 1</li> <li id="Item2">Item 2</li>
or as
<li id="Item1">Item 1</li>
<li id="Item2">Item 2</li>
but not the same as
<li id="Item1">Item 1</li><li id="Item2">Item 2</li>
This last one should come out as Item1Item2.
|