Why is xml:space set to 'preserve' on all elements of XHTML?
I don't want to see extra space in my output.
Answer / guest
The attribute xml:space is about input: that is to say, it
controls if the spaces will be present in the DOM (i.e. in
the internal version of the document inside the browser); it
says nothing about what will appear on your screen. Output
whitespace is controlled by the CSS property 'whitespace'.
Set it to 'pre' and the spaces in the DOM will be preserved
on output; set it to 'normal' and the whitespace will be
collapsed (CSS3 will have more properties to enable greater
control).
This is the reason that all elements are set to
xml:space="preserve" in XHTML2, otherwise the CSS
'whitespace' property would have no effect, and you would
have no control over visible whitespace. The default
stylesheet will set 'whitespace' to 'normal' for all
elements except <pre>, but you will be free to change them.
| Is This Answer Correct ? | 0 Yes | 0 No |
Is it possible to have multiple actions in a same form?
List out media related elements in html5?
How would you automatically transfer your visitors to a new web page?
What is canvas in HTML5?
Why xhtml is needed?
How do I create keywords for my website?
what purpose does html5 serve?
What hierarchy is being followed when in style sheets?
What is getelementbyid innerhtml?
How do I create a link that sends me email?
What is meant by html5?
How do I eliminate the blue border around linked images?