? about styles.css entries

Quick question… in styles.css what does the comma MEAN or DO, because one section they had me use one, and another they didn’t… like:

header h1 {
text-align: center;
margin: -4px 0;
letter-spacing: 0.15px
}

.lg, .md {
background-color: black;
border: 0;
}

Thanks for any clarification!!!

Paul Allen

“;” this symbols matters, everytime you declare an styles. Helps to the program to recognize the end of a style declaration.

header h1 {
text-align: center;
margin: -4px 0;
letter-spacing: 0.15px // ← here’s the problem
}

Thank you, but I had the ; … this was just a copy and paste. The question was whats the difference, in styles.css, between these first two lines;

header h1
.lg, .md

one has a comma in between… i’ve learned even more crazy ways since, but i wasn’t understanding the difference between NO COMMA and a COMMA in between. Again, thanks much - you WERE eagle-eyed. :stuck_out_tongue:

The first one is saying “target any h1 element that is a descendant of a header element”. So

<header>
  <h1>...</h1>
</header>

Would match it. So would:

<header>
  <div>
    <h1>...</h1>
  </div>
</header>

The second one is saying “target either an element with a class of lg or an element with a class of md”. So the second one allows you to target multiple distinct elements with one rule set. There is no hierarchical relationship between them like there is with the first one.

Ok… got it. Don’t COMPLETELY grasp it, but some testing will show me easily. I’ve been learning a lot more ways you can manipulate classes, id’s, etc there… thanks for the great answer. :stuck_out_tongue: