If you find this helpful, please click the Google Button to the left, if it is white, to make it turn blue or red. Thank you! (It also helps find this page again more easily.) |
HTML <![CDATA[...]]>
Sections
A CDATA section is used for content that is to treated entirely as character data. HTML markup tag delimiters <
, >
and />
will not cause the parser to interpret the code as HTML elements.
<![CDATA[...]]>
Section Syntax
Rules for coding CDATA sections in HTML or XML documents
- Code a CDATA section only in code that is being interpreted as XML, which includes MathML content, RDF data or SVG code, or in HTML code that is being interpreted as XML or xHTML, the XML serialization of HTML.
CDATA Section Examples
Examples of CDATA sections in HTML 5
CDATA in HTML title
<title>A Tutorial: <![CDATA[<!-- HTML Comments -->]]></title>
Use a CDATA section to escape text containing the comment delimiters (<!--
) in text content so that it appears for all browsers. Otherwise comments should not be coded inside a <title>
tag. (See the issues with HTML 5 comments.)
CDATA with ]]>
<![CDATA[... ]]]><![CDATA[]> ...]]> <![CDATA[... ]]]]><![CDATA[> ...]]>
Since the characters ]]>
terminate a CDATA section, those characters must be split into two different CDATA sections.