GO-Ve01
ServicesDevelopersBooksDictionaryPapersWikidataEncyclopediaSearchBabelCareersDeck

`style` HTML global attribute

The style global attribute contains CSS styling declarations to be applied to the element. Note that it is recommended for styles to be defined in a separate file or files. This attribute and the style element have mainly the purpose of allowing for quick styling, for example for testing purposes.

The **`style`** [global attribute](/docs/Web/HTML/Reference/Global_attributes) contains [CSS](/docs/Web/CSS) styling declarations to be applied to the element. Note that it is recommended for styles to be defined in a separate file or files. This attribute and the style element have mainly the purpose of allowing for quick styling, for example for testing purposes.

> [!NOTE]
> This attribute must not be used to convey semantic information. Even if all styling is removed, a page should remain semantically correct. Typically it shouldn't be used to hide irrelevant information; this should be done using the [`hidden`](/docs/Web/HTML/Reference/Global_attributes/hidden) attribute.

tabbed-shorter

```html interactive-example
<div style="background: #ffe7e8; border: 2px solid #e66465">
<p style="margin: 15px; line-height: 1.5; text-align: center">
Well, I am the slime from your video<br />
Oozin' along on your livin' room floor.
</p>
</div>
```

## Specifications

## Browser compatibility

## See also

- [Global attributes](/docs/Web/HTML/Reference/Global_attributes)
- HTMLElement.style

source: MDN Web Docs mirror · page

Cite this

"`style` HTML global attribute". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/style

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·