You have the correct code, but you need to delete the top part. Your code should look like this:
h1,h2,p{
text-align: center;
}
What this does is it gives the same styling to the h1, h2, and p elements in fewer lines of code. The rest of the code needs to be deleted, otherwise you are just repeating yourself. It is important to try to avoid this, as if you do this in a real project, it can cause your code to work incorrectly (from personal experiance).
Thanks for your response, Ok so basically in terms of practical world usage it would create bugs? And isn’t necessary needed and is just something to know? Is that correct.
Sorry but that is not what I meant. This is very useful because you can shorten the length of your code signifigantly (which is a good thing). What I meant is that you mistake brings up a important tip. Be careful to not use multiple seperate sectors like this:
In this example, we apply the same thing to the same element, but use two seperate sectors. In this case, at least your code would still work (though it is longer than it needs to be). However, if you make this mistake often enough, it can sometimes cause certain styling to not work (such as the margin properties).
It is also useful to mention this can sometimes occur when using even just similar sectors (such as nav, and nav li). I just wanted to mention this as this caused me some trouble with my projects, and I wanted to give you this tip so you can avoid it yourself. If anything, using the multiple style sector actually helps to avoid this issue!
Hopefully that clears things up a bit! Sorry about that.