Skip to content

no-style-tag

Reports a <style> element. A <style> inside a <template> is not reported.

A stylesheet that is part of the page is sent again with every page, cannot be cached or shared, and is blocked by a strict content security policy.

To fix, move the rules to a file and use <link rel="stylesheet">.

Reported
<head>
<style>p { color: red }</style>
<template><style>p {}</style></template>
</head>
angular:
lint:
rules:
no-style-tag: warn # off (default), warn, error
html:
lint:
rules:
no-style-tag: warn # off (default), warn, error
svelte:
lint:
rules:
no-style-tag: warn # off (default), warn, error
vue:
lint:
rules:
no-style-tag: warn # off (default), warn, error

Enabled by the presets: html/htmlhint.

Suppress one line with sudsy-disable-next-line no-style-tag in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
html-validate no-style-tag full
htmlhint style-disabled full