Inline Styles

An inline style may be used to apply a unique style for a single element. An inline style loses many of the advantages of a style sheet (by mixing content with presentation). Use this method sparingly!

To use inline styles, add the style attribute to the relevant tag. The style attribute can contain any CSS property. This example shows how to change the color and the left margin of a <h1> element:

HTML file: Displayed by browser:
<h1 style="color:blue;margin-left:30px;">This is a heading.</h1>

This is a heading.


Back buttonTable of ContentsNext button