<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Piano</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="./styles.css">
</head>
<!-- Most of the html part because it is not important to my question -->
</html>
I have a doubt, is there any difference between html selector and * selector?
I thought they both serve the same context.Please correct me If I am wrong
Yes, I already had solved the answer above. I am really only seeking an explanation as to why it was written that way instead of the usual way which i’ve copied down below. This is how other people have done it for tutorials I have followed along.
Okay I am thinking I am beginning to get it. So then freeCodeCamp wasjust using html as an introductory to lead into an even better selector which is the everything selector *.
However, my question I am guessing is, in theory doesn’t both of these selectors work the same in either case. Since html is the first element surrounding everything then it should still function as the *.
Also, the * doesn’t capture the pseudo elements before and after so that is why they still need to be included as a selector right?
* is for elements only yes.
The html and * do different things.
But also in css there are multiple ways for doing the same thing.
If the code doesn’t have a html tag, then the asterisk will work. There are different applications for both. Just understand that they exist and hopefully you can remember them when you need them.
Okay I think this will satisfy me for now. I think If I just need to keep coding and reviewing examples eventually be able to see the case basis for the two. Thank you so much for helping to walk me through it.