Creating classes

Okay so I am trying to create a class that is responsible for the color and font for the title of my website, but it’s not working when I run it. Help please.

    .h1 {
  <h1 class ="h1"> This is a website. </h1>

h1 is a html tag and not a class, you should just use


instead of


for html tags like <h1>, <p>, <img>
you should select it without the .(dot)

1 Like

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.


1 Like

Thank you! It turns out that the free online html editor I was using doesn’t support using classes with html. Can you suggest any free online html editors? Thanks in advance.

You could give code pen a try.