Click here to get back home

White space, new lines in tags

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
White space, new lines in tags Harlan Messinger 03-25-2006
Posted by Harlan Messinger on March 25, 2006, 1:52 am
Please log in for more thread options


What rules deal with attribute values with trailing spaces, or tags or
attribute values with embedded newlines? Examples below: the HREF with
embedded newline, the SRC with trailing spaces, and IMG tag spread over
multiple lines.

        <a href="myself.html
                ">
        <img src="/images/picture.gif " width="80"
                height="65"
                alt="What, me worry?"></a>

Posted by Benjamin Niemann on March 25, 2006, 9:48 am
Please log in for more thread options


Harlan Messinger wrote:

> What rules deal with attribute values with trailing spaces, or tags or
> attribute values with embedded newlines? Examples below: the HREF with
> embedded newline, the SRC with trailing spaces, and IMG tag spread over
> multiple lines.
>
> <a href="myself.html
> ">
> <img src="/images/picture.gif " width="80"
> height="65"
> alt="What, me worry?"></a>

White space (including linebreaks) between attributes is not significant,
use it as much as you like - I use this often to keep lines short.

Regarding white space in attribute values: the HTML Spec says
User agents may ignore leading and trailing white space in CDATA
attribute values.
<http://www.w3.org/TR/REC-html40/types.html#h-6.2>
I have not tested this in detail, but I think that most browsers do strip
the white space - I have seen various sites with such links and it seems to
work. But you should not rely on it, some UAs may not do it and encounter a
broken link.

--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://pink.odahoda.de/

Posted by Csaba Gabor on March 27, 2006, 3:47 am
Please log in for more thread options


Harlan Messinger wrote:
> What rules deal with attribute values with trailing spaces, or tags or
> attribute values with embedded newlines? Examples below: the HREF with
> embedded newline, the SRC with trailing spaces, and IMG tag spread over
> multiple lines.
>
>         <a href="myself.html
>                 ">
>         <img src="/images/picture.gif " width="80"
>                 height="65"
>                 alt="What, me worry?"></a>

<span id=foo onclick="alert('Don\'t \
forget&nbsp;to include &#x5C;
this')">Click me</span>

Csaba Gabor from Vienna


Posted by jschleiden on April 10, 2006, 5:08 pm
Please log in for more thread options


How about something like this:

<div id="content" class="example TemplateExample">whatever</div>

How is that handled? Also what is the benefit?
-j


Posted by Jack on April 11, 2006, 5:27 am
Please log in for more thread options


jschleiden@gmail.com wrote:
> How about something like this:
>
> <div id="content" class="example TemplateExample">whatever</div>
>
> How is that handled? Also what is the benefit?

That declares a <div> element that belongs to two distinct classes. The
benefit might be some elegance/efficiency in the associated CSS.

--
Jack.

Similar ThreadsPosted
adding white space in

August 31, 2005, 4:34 pm
White space, collapsing March 28, 2006, 10:47 am
Don't bother saving white-space August 19, 2004, 9:49 pm
White space problem (table) April 3, 2006, 8:31 am
some (undesired) white space in Firefox but not IE November 6, 2006, 2:27 pm
Table problem: 1px white space February 19, 2008, 7:13 am
 versus  white-space:pre; when pasting
July 20, 2005, 12:06 am
Style tags -- Eeek how obese these tags make HTML! November 8, 2006, 3:33 am
Meta Tags, Link Tags, other September 27, 2005, 3:29 pm
Table without lines June 12, 2008, 12:15 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap