Prevent PHP Tidy from converting style tag data to CDATA Prevent PHP Tidy from converting style tag data to CDATA php php

Prevent PHP Tidy from converting style tag data to CDATA


Turn off the output-xhtml option. The CDATA wrapping is required for XHTML, as CSS can contain unescaped > characters.


The addition of CDATA tags is intended to help browser know they should parse characters like '<' and '&' as literal characters instead of html syntax. Tidy does not appear to have any documented configuration that would prevent generating them for inline css/javascript. The only option would be moving the css to a separate file. In which case it doesn't need the CDATA tag.

see http://tidy.sourceforge.net/docs/quickref.html and https://en.wikipedia.org/wiki/CDATA for more information.


One way to handle it is to use a link to an external stylesheet.

<link rel="stylesheet" type="text/css" media="screen, print" href="site.css">