What's the HTML tag that doesn't process HTML inside of it?
Google fail, I used to know what it was years ago...
Basically would make <theTag><img src='cat.jpg'/></theTag>
render as <img src='开发者_JS百科cat.jpg'/>
rather than actually displaying the image...
The tag is <xmp>
, but it's deprecated.
A better way to go is to replace <
and >
with <
and >
, respectively. Also, &
with &
, and you should be perfectly safe.
i think you are looking for the <xmp> tag but that is nowhere near valid HTML anymore :)
http://www.w3.org/TR/REC-html32#xmp
You’re probably talking about CDATA sections?
<![CDATA[<img src='cat.jpg'/>]]>
Be careful though, this doesn’t work very well in some browsers. Plus, I think it doesn’t exist in HTML, only in XML. It exists in HTML but browser support is not reliable. It’s better to just escape everything.
What about <pre>
? As far as I understand it's made exactly for these cases.
精彩评论