# CodeMirror: HTML mixed mode

<html style="color: green"> <!-- this is a comment --> <head> <title>Mixed HTML Example</title> <style type="text/css"> h1 {font-family: comic sans; color: #f0f;} div {background: yellow !important;} body { max-width: 50em; margin: 1em 2em 1em 5em; } </style> </head> <body> <h1>Mixed HTML Example</h1> <script> function jsFunc(arg1, arg2) { if (arg1 && arg2) document.body.innerHTML = "achoo"; } </script> </body> </html>

The HTML mixed mode depends on the XML, JavaScript, and CSS modes.

It takes an optional mode configuration option, `scriptTypes`, which can be used to add custom behavior for specific `<script type="...">` tags. If given, it should hold an array of `{matches, mode}` objects, where `matches` is a string or regexp that matches the script type, and `mode` is either `null`, for script types that should stay in HTML mode, or a mode spec corresponding to the mode that should be used for the script.

MIME types defined: `text/html` (redefined, only takes effect if you load this parser after the XML parser).