Re: HTML 4.01 and 5.0: is it somewhat "unspecific" about space characters

Frank Ellermann wrote:
> Daniel Beardsmore wrote:
>  
>> My favourite is this one:
>  
>>   <ul>
>>    <li><a href...>Foo</li>
>>    <li><a href...>Bar</li>
>>    <li><a href...>Baz</li>
>>   </ul>
>  
>> Now, there's no way to get the list items to butt up against each
>> other. For example, if you intend for this:
>  
>>   [ Foo ][ Bar ][ Baz ]
>  
>> The white space will give:
>  
>>   [ Foo ] [ Bar ] [ Baz ]
>  
>> Although all white space between <li>s will normally be dropped, if
>> you set li { display: inline } to get them in a horizontal line, now
>> you'll get exactly one space between each. The spaces between </li>
>> and <li> will collapse to a single, visible space.
> 
> Are you sure that that is what happens there ?  Do you get a different
> result if anything from <ul> to </ul> is written in one line with no
> explicit space in the list at all ?

You don't see explicit space? I see explicit space. For example, all the
<li> elements are indented. They're also separated by line breaks, which may
or many not be converted to spaces.

> As a practical matter, list items separated by "something", minimally
> a space, make sense, don't they ?  Especially for your example with
> three links, AFAIK adjacent links are supposed to be separated.

Without CSS, they're going to be separated, sure. However, sometimes you
want to set a background on each <li> and have them all join to form a solid
bar, with padding within the <li> to keep the text apart. You want the space
between the <li>s to be dropped as though they were still all block elements.

The only way to achieve this, right now, is with table cells, or by butting
the list items together:

  <ul>
   <li><a href...>Foo</li><li><a href...>Bar</li><li><a href...>Baz</li>
  </ul>

This makes the HTML very hard to follow after a few list items, and removes
the space that separates items when there's no CSS. You can have spaces
inside the list items or links, although that won't make the HTML much more
readable.

Received on Monday, 31 March 2008 08:27:25 UTC