What exactly is CDATA and what does it do?

前端 未结 4 484
予麋鹿
予麋鹿 2021-01-04 08:58

I sometimes notice a CSS or JS code surrounded with and ]]> tags. I couldn\'t find any explanation to this. What does CDATA do? Why

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-04 09:09

    When you write inline javascript or CSS in an HTML file (using the script and style tags), Those CDATA comments prevent things like the HTML validators from catching false positives when validating an HTML document.

提交回复
热议问题