Why is xml:space set to 'preserve' on all elements of XHTML?
I don't want to see extra space in my output.
Answer Posted / 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 |
Post New Answer View All Answers
What is the html document?
Difference between and tag?
why it is important to set the meta information?
How do you anchor in html?
How to open mail window from html ?
how can you open an url into a new tab when clicked?
What is the difference between html4 and html5?
What are keyword tags?
List out image related elements in html5?
What xhtml means?
What is doctype used for in html?
Which video and audio formats are used for embedding on web page?
What is session storage and how can you create one?
What are grouping elements in html?
Why div is used in html?