I was just looking at my CSS and the h1 tag is defined like this:
h1 { .... }
When everything else either has an id “#” or a “.” class preceding it. What is the reason header tags don’t need this? Have I infact made a mistake and they do need one?
This means that all occurences of
h1will share the same style. Similarly, you can have a style defined for any other element, e.g.:That means all
ptags will use the Helvetica font.Note that it’s also a best practice to have just one
h1element in a page.You can find a brief overview what different types of selectors mean here.