HTML <![CDATA[...]]> Sections

 

ATTENTION: THIS PAGE IS Valid HTML 5 AND IS BEST VIEWED WITH HTML 5 - Please upgrade your browser or download one of the HTML 5 compatible browsers such as Mozilla Firefox, Chrome, Opera or IE 9 (March 14, 2011 or later). For more information see HTML 5 browsers.


If you find this helpful, please click the Google +1 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.)


PDF mobile

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.


Changes in HTML 5 - CDATA Sections

What's new in HTML 5
Differences between HTML 5 and earlier versions of HTML

Valid HTML 5