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 a label tag?
Which browsers support dhtml and how will non-supporting browsers handle dhtml?
How to create scrollable tables in HTML-DHTML? My doubt is "I want to create a table whose header will remain stationery when I scroll the table vertically, but at the same time when I scroll horizontally, the header should scorll sidewise along with the body."
Why div tag is used in html?
Tell me how to add video and audio in html5
What are inline elements and block-level elements in html?
What is singular tag?
What is tag in ela?
What is the difference between html5 and html?
How to create a new html element?
How do you use tags?
Explain autocomplete attribute of html5?
What happens if doctype is not specified?
What is a tag for writing?
Describe in brief HTML Tables?