Tutorials References Exercises Menu
Paid Courses

HTML style Attribute

Definition and Usage

The style attribute specifies an inline style for an element.

The style attribute will override any style set globally, e.g. styles specified in the <style> tag or in an external style sheet.

Applies to

The style attribute is part of the Global Attributes, and can be used on any HTML element.

Element Attribute
All HTML elements style


Use of the style attribute in an HTML document:

<h1 style="color:blue;text-align:center">This is a header</h1>
<p style="color:green">This is a paragraph.</p>
Try it Yourself »

Browser Support

style Yes Yes Yes Yes Yes