style

The style global attribute applies inline CSS declarations directly to a single element.

Since HTML 4.0 Spec ↗

Syntax

style="prop: value;"

Examples

<p style="color: rebeccapurple; font-size: 1.25rem;">Inline styled text</p>
<div style="--gap: 1rem; gap: var(--gap);"></div>
Output
Renders the paragraph in purple at 1.25rem and sets a custom property on the div.

Notes

Inline styles have very high specificity and override most stylesheet rules, so use sparingly. Useful for dynamic per-element values and setting CSS custom properties. Blocked by strict CSP without a hash/nonce in some configurations.

Browser & runtime support

EnvironmentSince version
chrome 1.0
firefox 1.0
safari 1.0
edge 12

See also