views:

159

answers:

4

Is   allowed to make space in terms of semantic, web standards and accessibility and cross browser compatibility?

+2  A: 

Sure, why not? In a case like $ 10, to prevent a line break between the $ and the 10, this is perfectly acceptable.

Just don't use   for things it wasn't intended for, such as indentation.

Thomas
A: 

  stands for Non-breaking space and is a simple Character Entity reference. They are allowed in any text in HTML semantically.

AverageAdam
+3  A: 

The reason it was invented was to prevent line breaks (in fact it's an acronym "non-breaking space"), however it's obsolete: You should use the "white-space:nowrap;" CSS attribute.

Whatever you do, NEVER use it to indent or as a "separator" between, for example, table cells.

<p>Hello&nbsp;to&nbsp;you</p>

Is equivalent to the preferred form

<p style="white-space: nowrap">Hello to you</p>
Andreas Bonini
A: 

Since you tagged your question with “XHTML”, the answer is “it depends”.

If you serve your XHMTL documents as XML then Firefox will not read entities from the DTD file. As a consequence, it won’t recognized named entities such as &nbsp;. However, this is a rare case because XHTML documents are normally served as HTML to accommodate non-supporting browsers (= MSIE).

That said, “make spaces” is a rather nebulous term. You should use CSS to position your elements and put indentations in the text (other than source code inside a <pre> tag). Do not use spaces for formatting purposes, ever (the same is true in text processing applications). This isn’t acceptable semantically and it will screw with your layout as soon as the users have some custom settings enabled in their browsers. Non-breaking spaces are only to be used, as the name indicates, to prevent a break between things that belong on one line, e.g. a product name and the product version number: e.g. “Ubuntu 10&nbsp;9.10”, or inside a telephone number or in formulae.

Konrad Rudolph
how screen reader will read  ?
metal-gear-solid
Screen readers should just ignore that, it’s simply another whitespace to them.
Konrad Rudolph