Widely availableSupported across all major browsers. Safe to use in production.

Overview

The style global HTML attribute applies inline CSS styling declarations to individual elements.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
1
12
1
1
18
1
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)

Syntax

HTML
<p style="color: #c00; font-weight: bold; margin: 1rem 0;">
  Text formatted with inline styles
</p>

Live demo

inlinestyle

Style attribute in element to directlyCSSstyle apply.

PreviewFullscreen

inlinestyle. Priority

Style attribute is partCSS than also highdetaildegree has.

PreviewFullscreen

Cssclass vs inlinestyle

inlinestyle and CSSclass. Compare usage.

PreviewFullscreen

Use cases

  • Using style (attribute)

    The style global HTML attribute applies inline CSS styling declarations to individual elements.

Cautions

  • May not be supported in older browsers.

Accessibility

  • Verify how this element is announced by screen readers.

Powered by web-features