Skip to content

No way to get past complaints about <style> outside of <head> #730

Open
@petdance

Description

@petdance

Here's an HTML file with <style> tag outside of the <head>.

$ cat -n foo.html
     1  <!DOCTYPE html>
     2  <html>
     3      <head>
     4          <title> style outside of the head </title>
     5      </head>
     6      <body>
     7          <style>
     8              foo { text-align: center }
     9          </style>
    10          <p class="foo">
    11              This should be centered
    12          </p>
    13      </body>
    14  </html>

Tidy complains about it.

$ tidy -q -e foo.html
line 7 column 9 - Warning: moved <style> tag to <head>! fix-style-tags: no to avoid.

So I do what tidy says and it complains a different complaint.

$ tidy -q -e --fix-style-tags no foo.html
line 7 column 9 - Warning: found <style> tag in <body>! fix-style-tags: yes to move.

What can I do to make tidy happy about this situation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions