Graphics blips

Jason Stephenson jason at sigio.com
Wed Jul 16 10:51:04 EDT 2003


Cole Tuininga wrote:
>>>Stupid HTML *grr*.
>>
>><grin> Maybe, but this one's a PEBKAC issue...  ;-)
> 
> 
> Is this strictly true?  My understanding is that the problem is that
> browsers are "supposed to" ignore newlines, yet none seem to ... 

No. Browswers don't ignore newlines. Runs of whitespace are generally 
collated into a single whitespace. Line feeds count as whitespace, as do 
ASCII tab and space characters, form feed and zero-width space.

 From the HTML 4.01 "standard":

A line break is defined to be a carriage return (&#x000D;), a line feed 
(&#x000A;), or a carriage return/line feed pair. All line breaks 
constitute white space.

In the part about white space, it says that only tab, space, form feed, 
and zero-width space are defined as white space. Then, in the next 
sentence, it goes to say the line breaks are also white space.

Furthermore, it does not specifically say what browsers are to do with 
white space characters, or runs of white space characters. Just that 
whatever is done should make sense for the language of the document. In 
the <pre> element, of course, white space is to be maintained.

It goes on to say that HTML authors should not rely on browser behavior 
concerning whitespace after a beginning tag and before an ending tag. 
They specifically use an example of an anchor tag with whitespace at the 
end saying it is better to use it with the tag directly against the text.

The XHTML documents have less to say on the matter, although CR and LF 
are defineed as white space. Basically, they punt and say that the XHTML 
processor should conform with the directives in the CSS for handling 
white space.

> If that's the case, then the "fault" (if one were to really care about
> such things) would seem to be in the hands of the browsers.





More information about the gnhlug-discuss mailing list