CSS: Inline Styling

Inline styling is useful for applying a unique style to one HTML element, by using the style attribute, which is written as:

style="property:value;"

In this example, we use inline styling to change the text color of a single heading, from the default black, to blue:

HTML file: Displayed by browser:
<h2>This is the default Black Heading</h2>
<h2 style="color:blue">This is a Blue Heading</h2>

This is the default Black Heading

This is a Blue Heading


Back buttonTable of ContentsNext button