Welcome to WebmasterWorld Guest from 54.159.44.227

Forum Moderators: incrediBILL

Message Too Old, No Replies

&#160 or  ?

regarding div / td spaces

     

rawrhythms

1:46 am on May 1, 2004 (gmt 0)

10+ Year Member



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

vkaryl

2:11 am on May 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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

DrDoc

2:52 am on May 1, 2004 (gmt 0)

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



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

3:03 am on May 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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

9:12 am on May 1, 2004 (gmt 0)

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



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. ;)

 

Featured Threads

Hot Threads This Week

Hot Threads This Month