homepage Welcome to WebmasterWorld Guest from 54.242.241.20
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
&#160 or  ?
regarding div / td spaces
rawrhythms

10+ Year Member



 
Msg#: 7806 posted 1:46 am on May 1, 2004 (gmt 0)

what's the difference? and which is a better choice for adding space to a blank div or td?

 

vkaryl

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 7806 posted 2:11 am on May 1, 2004 (gmt 0)

Have you tried validating both? If so, do they both validate? One does, the other doesn't? Neither?

DrDoc

WebmasterWorld Senior Member drdoc us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 7806 posted 2:52 am on May 1, 2004 (gmt 0)

Welcome to Webmaster World!

Regarding validation, vkaryl is referring to the W3C Markup Validator [validator.w3.org].

However, there's more to it than that. As you know,   is a "no-break space" -- always, no exceptions, no matter where in the world you are.   is what? Charater number 160 in the current character table. What exactly does that mean? Well, that depends on what your character set is. For anyone with a latin based alphabet character number 160 is a no-break space. Luckily, there seems to be no difference between different character sets on this matter. Thus,   ==   ==   == no-break space. But, that's only the case for this single character entity. We cannot assume anything about character entities being equal to a numeric character reference. If you wish to use a numeric reference you should always use the unicode numeric reference, or else you may run into unexpected behavior.

iamlost

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 7806 posted 3:03 am on May 1, 2004 (gmt 0)

HTML validator throws up:

character data is not allowed here:  

From reference:
[w3.org ]

If the character reference begins with "&#x", the digits and letters up to the terminating ; provide a hexadecimal representation of the character's code point in ISO/IEC 10646. If it begins just with "&#", the digits up to the terminating ; provide a decimal representation of the character's code point.

...

All text that is not markup constitutes the character data of the document.

...

The ampersand character (&) and the left angle bracket (<) may appear in their literal form only when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section. They are also legal within the literal entity value of an internal entity declaration; see "4.3.2 Well-Formed Parsed Entities". If they are needed elsewhere, they must be escaped using either numeric character references or the strings "&amp;" and "&lt;" respectively.

I did not try escaping the character - you can if you think it is worth it.

[edited by: tedster at 6:53 am (utc) on May 1, 2004]
[edit reason] disable graphic smilies [/edit]

whoisgregg

WebmasterWorld Senior Member whoisgregg us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 7806 posted 9:12 am on May 1, 2004 (gmt 0)

Which one validates depends on your doctype/charset. I typically work in charset ISO-8859-1 which uses the &nbsp; but these days I am doing XML/XSL work in charset UTF-8 which REQUIRES &#160;

Answer to original question: depends. ;)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved