Placement of style tag in HTML document

Hello all,

The class “Selectors and Visual Rules” states:

Blockquote To use the <style> element, it must be placed inside of the <head> element.

However, it still renders whenever place anywhere in the document. Such as:

<!DOCTYPE html>
  <h1>Hello, world</h1>
    body {
      background-color: pink;
      color: white;
      font-family: Arial;

Rendered version:

Although it is not accepted practice to do this, it does still work in a modern browser. Presumably, this is because modern browsers are very forgiving when parsing HTML, even if it is not correctly formatted.

Would I be correct in thinking this?


That is correct. Browsers these days are way too smart.

1 Like