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 |
How to create and access sessionstorage object in html?
What is the use of dhtml?
What is the tag to create lists in html?
What is the difference between local storage and cookies?
What is div and span tag?
What is the difference between “display: none” and “visibility: hidden”, when used as attributes to the HTML element.
How to create and access sessionstorage object in html5?
What is a Canvas? What is the default border size of a canvas?
What is difference between innertext and innerhtml?
How do you write a meta description?
What is local storage in html5?
What is a tag in html?