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

Is   allowed to create space in terms of semantic, web standards and accessibility and compatibility with multiple browsers?

+6
accessibility w3c xhtml
source share
4 answers

The reason it was invented was to prevent line breaks (actually the abbreviation "inseparable space"), but it is deprecated: you should use "white-space: nowrap"; CSS attribute.

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

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

Equivalent to the preferred form.

 <p style="white-space: nowrap">Hello to you</p> 
+6
source share

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

If you are submitting XHMTL documents in XML format, Firefox will not read objects from the DTD file. As a result, it does not recognize named objects such as &nbsp; . However, this is a rare case, because XHTML documents typically serve HTML to host impractical browsers (= MSIE).

However, making spaces is a rather vague term. You must use CSS to position your elements and indent text (except for the source code inside the <pre> ). Do not use spaces for formatting, ever (the same is true in word processing applications). This is not semantically acceptable, and it will spin up with your layout as soon as users have custom settings in their browsers. Non-breaking spaces should be used only, as indicated in the title, to prevent a gap between things belonging to the same line, for example. product name and product version number: for example. " Ubuntu 10&nbsp;9.10 " either inside a phone number or in formulas.

+3
source share

Of course, why not? In the case of type $&nbsp;10 , to prevent line breaks between $ and 10, this is perfectly acceptable.

Just don't use &nbsp; for things for which it was not intended, for example, indentation.

+2
source share

&nbsp; means inextricable space and is a simple reference Character Entity . They are allowed semantically in any HTML text.

0
source share

All Articles