I already have the answer, im just wondering why sometimes its “one” and other times its “.one” i thought the “.” was added before a selector if it was a new class that hadnt been added to the index,html yet but it seems to be more situational than that?
**Your code so far**
/* file: index.html */
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<h1>CSS Color Markers</h1>
<div class="marker one">
/* file: styles.css */
margin: 10px auto;
**Your browser information:**
User Agent is:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.102 Safari/537.36 Edg/104.0.1293.63
Challenge: Learn CSS Colors by Building a Set of Colored Markers - Step 18
Link to the challenge:
This code should not be passing. Has it passed when you press the ‘check your code’ button?
A css class referenced in a html file should always have the . in front of it.
no it told me it was wrong until i put . in front of “one” but when is it right to put the . in front and when should i not use the .
You should use . when you are using class.
ok i get it now, so we dont use the . when the class hasn’t been specified in the index.html yet right?
Yep you are right. Same goes with id you only use # when you’re using id.
Sorry i forgot we had already set the class for one, it was specified with the other class marker in the same div so i completely looked over it, it was
i was looking for a <div class=“one”
Always use the dot in front of a css class selector.
However, selectors like h1, p, img are not css classes. Do not put a dot in front when writing them in css.
Yes!! That exactly what confused me thats why i was wondering what the rules were for that, in a few of the other steps i put . in front of h1 and img and it wouldnt accept it . Thats when i first noticed the “inconsistencies”, but i just didnt understand it. Thank you Ella!