It appears <pre> and <code> are ignored by IE8 and FF10. What can I do to display preformatted text?
It appears <pre> and <code> are ignored by IE8 and FF10. What can I
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
They are not ignored. The
<code>element has nothing to do with preformatted text, but it by default sets the font to monospace. The<pre>element works universally. But neither of these elements overrides the normal HTML rule that the<character followed by a letter starts a tag; they are not defined to do so, and they do not actually do so in browsers. I suspect a misunderstanding of this is the background to your question.Thus, within these elements, as elsewhere, to display
<as data, write<, and to display&as data, write&.The
<xmp>element is different. Within it, no markup is recognized, i.e. all characters are shows as-is; the end tag</xmp>is recognized, of course. Though this element was deprecated in HTML 3.2 and removed from later specs (though it is mentioned as obsolete in HTML5), it still seems to have support in all browsers. There was also a very similar element,<listing>, for wide listings, but support to it has been dropped.