HTML style Attribute

Definition and Usage

style The attribute specifies the inline style (inline style) of the element

style The attribute will override any global style settings, such as those specified in the <style> tag or in an external stylesheet.

style The attribute can be used for any HTML element (it will validate any HTML element, but may not be useful).

See also:

HTML Tutorial:HTML attributes

CSS Tutorial:CSS Introduction

JavaScript Tutorial:JavaScript HTML DOM - Change CSS

HTML DOM Reference Manual:HTML DOM Style Object

HTML DOM Reference Manual:HTML DOM style Attribute

HTML DOM Reference Manual:JS getComputedStyle() Method

Example

Use the style attribute in HTML documents:

<h1 style="color:blue;text-align:center;">This is the Title</h1>
<p style="color:green;">This is a paragraph.</p>

Try It Yourself

Syntax

<element style="style_definitions">

Attribute Value

Value Description
style_definitions

One or more CSS properties and values separated by semicolons.

For example: style="color:blue;text-align:center"

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support