Inline Styles

The first way to write CSS code is called inline styles. It means writing CSS code directly in HTML.

To style an element this way, we need to add the style attribute to the element. The value of this attribute will be the CSS style we want to apply.

<p style="color:purple">Learning CSS!</p>

This code will be displayed as:

Learning CSS!

To apply multiple styles, we can use ; and write another style after it, like this:

<p style="color:purple;text-align:center">Learning CSS!</p>

This will be displayed as:

Learning CSS!

Instructions

Using inline styles, add the color blue to the h1 element.

Start programming for free

By signing up, you agree to the Terms of Service and Privacy Policy.

Or sign up with:

2/5