SEO check

Inline CSS: What It Is, Why It Gets Flagged and How to Fix It

Learn what inline CSS is, how our SEO report checks for it, whether it hurts SEO and the simple steps to move styles into a stylesheet.

Free to use 8 min read Updated Oct 2026

Inline CSS: the quick answer

Quick answer: Inline CSS is a style attribute written straight onto an HTML tag, such as <p style="color:red">, so the rule applies to that one element and nothing else. Our report counts every element on the rendered page that carries one, and it raises a warning, never a hard failure, when it finds any.

  • Pass: no element on the rendered page has a style attribute.
  • Warning: one or more elements do. A handful will not sink a page.
  • Fix: move the declarations into a class in your stylesheet, then swap the attribute for that class.

Check my website

You don't need an account to run the report.

What is inline CSS?

Inline styling lives in the HTML style attribute of a single tag. The value is a list of property: value pairs, each one a CSS declaration, separated by semicolons. There is no selector and no curly braces, because the attribute already belongs to one element. The W3C defines it in the CSS style attribute specification.

This inline CSS example styles one paragraph twice. The first version carries its rules on the tag, and the second moves them into a class.

HTML
<!-- Inline style -->
<p style="color: #0b3f44; font-size: 18px;">Free SEO checks</p>

<!-- Same result with a class -->
<p class="lead">Free SEO checks</p>
CSS
.lead {
  color: #0b3f44;
  font-size: 18px;
}

When rules clash, CSS specificity and the cascade decide. A normal inline declaration beats a normal rule from any stylesheet. To override an inline style from a stylesheet, you need an important declaration, though animations and scripts can override it too. Here the class wins:

HTML
<p class="lead" style="color: red">Green text</p>
CSS
.lead { color: green !important; }

Treat !important as a repair tool for markup you can't edit, such as plugin output, not a design tool.

People often mix up two different things here. A style attribute is inline CSS. A style element in the head is internal CSS, also called an embedded style sheet, and this report does not flag it.

How SEO Site Checker tests inline CSS

When you run our free SEO report, a headless Chromium browser opens your URL and waits for the load event. It then reads the HTML back from the browser, so it inspects the rendered Document Object Model, not the raw file your server sent.

The rule: the scanner counts every element that has a style attribute. Zero gives a pass. One or more gives a warning, which is added to the warning total in the report summary.

Empty attributes count, and so do elements inside inline SVG. There is no size threshold, so a single hit changes the result. A script that runs before the snapshot and sets element.style.color writes a style attribute, so that counts too. Anything added later is not seen.

Style elements in the head, external stylesheets and rules injected through the CSS Object Model (insertRule or adopted stylesheets) never count. The result row shows the element count, and logged-in users can expand it to see each tag with its style value.

Honest limit: the check tells you style attributes exist. It doesn't measure speed or Core Web Vitals, so clearing the warning is a maintenance win, not a promised speed gain.

Check my site free

Is inline CSS bad for SEO and page speed?

Not directly, because search engines don't penalize a style attribute as such. The real concerns are HTML file size, caching and upkeep, and each is modest.

Every inline declaration ships inside the HTML on every page view, while a stylesheet is cached, as the CSS caching guide explains. On a big template that weight adds to the totals in our web page size guide. Upkeep hurts sooner: the same teal pasted onto 40 tags means 40 edits for a rebrand, against one for a class.

Security is often forgotten. A strict Content Security Policy blocks style attributes unless it allows unsafe-inline, though style-src-attr can target them separately. The MDN page on the CSP style-src directive shows how.

The old advice to cut requests at any price has softened, because HTTP/2 makes extra files cheaper. Treat that as a reason not to cram everything into one file, not permission to scatter rules through the markup.

Inline CSS vs internal CSS vs external CSS

There are three ways to add CSS, and each trades convenience against control. This table shows where inline fits.

MethodWhere the rules liveReuse and cachingSpecificityBest use
InlineOn the tag, in a style attributeNo reuse, no caching beyond the HTMLHighest for normal rulesOne-off tweaks and email markup
InternalIn a style element in the headReused on one page, cached only with the HTMLMedium, set by the selectorA small block of first-screen styles
ExternalIn a linked .css fileReused everywhere and cached by the browserMedium, set by the selectorThe default for real sites

My rule of thumb: a linked stylesheet for the site, a small internal block of above-the-fold CSS, and inline only when nothing else can reach the element. Our render blocking resources guide explains why render-blocking CSS makes that middle option worth considering.

How to find inline CSS on your page

  1. Run the report. Open the Inline CSS row to see each tag and its style value.
  2. Search in DevTools. In Chrome DevTools open the Elements panel, press Ctrl+F (Cmd+F on a Mac) and type [style]. Or paste the line below into the console for a count.
  3. Compare the source. Search view source for style= and compare the hits with the rendered DOM. Script-added styles never appear there.
JavaScript
document.querySelectorAll("[style]").length

To read a saved copy of your markup, try the Online HTML Viewer.

How to remove inline CSS step by step

  1. List the hits. Copy the style attributes from the report and group the repeated declarations together.
  2. Name each group by purpose. Call the class .note-box, not .red-text, so the name survives a redesign.
  3. Move the rules. Put the declarations in your main stylesheet, delete the style attribute and add the class.
  4. Keep truly dynamic values. A progress bar width or a database image URL may need one style attribute. Setting a CSS custom property there and reading it from a class keeps the rule in the stylesheet, but the attribute remains, so the report still counts it.
  5. Minify and re-test. Minify CSS with the CSS Minifier, clear your caches and run the report again. The CSS minification guide covers the details.

Before and after example

A banner with three declarations becomes one class rule.

HTML
<!-- Before -->
<div style="background: #fff4ef; border: 1px solid #FF4001; padding: 16px;">Offer ends soon</div>

<!-- After -->
<div class="note-box">Offer ends soon</div>
CSS
.note-box {
  background: #fff4ef;
  border: 1px solid #FF4001;
  padding: 16px;
}

Inline CSS in WordPress, Shopify, Wix and page builders

Most people who hit this warning never typed a style attribute. The platform did, so ask what you can change.

WordPress

Moving a rule into Additional CSS does not remove the attribute the block editor wrote, because core spacing, colour and typography controls output a style attribute every time you use them. Clear those block settings, give the block a class under Advanced, Additional CSS class(es), and style that class in Additional CSS or your child theme. Page builder plugins add their own. Palette presets and the global styles in theme.json output classes instead, so prefer them.

Shopify

Many a Shopify theme feeds section settings into a style attribute in the section's Liquid file. Open it in the theme code editor and move the rule into a {% style %} block, which outputs a style element, or into a custom property that a class reads.

React, Vue and other app frameworks

The report counts the rendered page, so a React style prop or a Vue style binding shows up even though view source never contains it. Use classes for static values and custom properties for dynamic ones.

Wix, Squarespace and widgets

The editor controls the markup, so you can only change what you add through custom code fields. Widgets such as cookie banners inject their own styles, so ask the vendor or accept the warning.

When inline CSS is the right call

  • HTML email. Outlook's desktop apps handle style elements poorly and Gmail's support varies by account and app, so HTML email CSS is still written inline, usually by the email tool at send time.
  • Truly dynamic values. A chart bar width or a per-request colour can't live in a static stylesheet.
  • Critical CSS. Put it in a style element in the head, which the report does not count. Google's guide on how to extract critical CSS shows the method.
  • Quick debugging. A temporary style attribute is a fast test if it's gone before launch.

How to Fix

The short version, the same steps you see when you click How to Fix in your report.

Why this fails: one or more tags on your rendered page carry a style attribute. This is a warning about maintainability, not a broken page, and a few hits will not hurt you.

Inline rules travel inside every HTML response, can't be cached across pages and take many edits to change. A strict security policy can block them too.

How to fix it:

  1. List the style attributes shown in the Inline CSS row of your report. Log in (it's free) to see the full list, or search the page for [style] in DevTools.
  2. Create a class in your stylesheet with the same declarations, named for its purpose.
  3. Replace style="..." with class="..." on the tag.
  4. Keep a style attribute only for truly dynamic values, such as a bar width set per request.
  5. Minify the stylesheet and clear your caches.
HTML
<!-- Before -->
<div style="padding: 16px; border: 1px solid #FF4001;">Offer ends soon</div>

<!-- After -->
<div class="note-box">Offer ends soon</div>
CSS
.note-box { padding: 16px; border: 1px solid #FF4001; }
  • WordPress: clear the block's own spacing and colour settings, add a class under Advanced, and style it in Additional CSS or a child theme.
  • Shopify: move rules from the section's Liquid file into a {% style %} block or a custom property that a class reads.
  • Wix and page builders: only custom code fields can change this, and third-party widgets will keep their own styles.
  • Plain HTML: edit the files directly and link one shared stylesheet.

Zero is not required. HTML email and dynamic widths are fine, and critical CSS belongs in a style element in the head, which this check doesn't flag. See our CSS minification guide for the last step.

Re-test: run our free report again and open the Inline CSS row. The element count should be lower, or zero.

Re-test my website

Frequently Asked Questions

What is inline CSS?
Inline CSS is a set of style rules written in the style attribute of one HTML tag, with no selector, so the rules apply to that element only. It is the most direct way to style something and the hardest to maintain once a site grows past a few pages.
Does inline CSS override external CSS?
Yes for normal rules, because an inline declaration carries higher specificity than a selector in a stylesheet. The exception is a stylesheet rule marked important, which beats a normal inline one. To debug, inspect the element in Chrome DevTools and look for struck through declarations.
Is inline CSS bad for SEO?
No, search engines don't penalize it directly. The costs are bigger HTML, no caching of those rules across pages and harder upkeep, which can nudge speed on heavy templates. A few style attributes are harmless, which is why our report only warns about them.
Why does my report show inline CSS when I never wrote any?
Because the scan reads the rendered page, not your source files. Themes, page builders, plugins and scripts that run before the snapshot can all add style attributes. Log in and expand the Inline CSS row to see which element carries each one.
When should I use inline CSS?
Use it for HTML email, where many clients still handle inline styles best, for per-request values such as a chart bar width, and for quick debugging you remove before launch. On regular web pages, put the rules in classes inside an external stylesheet.
Can I use hover or media queries in inline CSS?
No. A style attribute holds plain declarations only, so it cannot contain pseudo classes such as hover or media queries. Those need a rule in a stylesheet or a style element, one more reason to prefer classes for anything interactive or responsive.
What is the difference between inline, internal and external CSS?
Inline CSS sits on the tag in a style attribute, internal CSS sits in a style element in the head of one page, and external CSS lives in a linked file the browser can cache. External is the default for real sites.

See how your site scores right now

Paste your address into the free report, then use the How to Fix button on anything that needs work.

Free to use. Results in under a minute for most sites.