Does hashtag(#) and dot(.) works the same way?

In Learn Accessibility by Building a Quiz, instead of using a dot(.) for a specified selector it became a hashtag(#) is it still doable? It just suddenly became hard to understand the course when I go to that specific module

Please post your code and a link to the challenge so that we can help more easily.

 <img id="logo" src="https://cdn.freecodecamp.org/platform/universal/fcc_primary.svg">

#logo {
  width: max(100px, 18vw);
	background-color: #0a0a23;
  aspect-ratio: 35 / 4;
	padding: 0.4rem;

 <p class="established">Est. 2020</p>

.established {
  font-style: italic;
}

}

The image and

came from two different modules. But my question is, if in CSS, does hashtag and dot is the same when you are targeting a specific selector?

It does not look like it according to MDN:

Dot stands for a class, so when you have <h1 class="header"> your CSS would be
.h1 {}

Hashtag stands for an id so when you have <h1 id="header"> your CSS would be
#h1 {}

2 Likes

Oh so hashtag(#) is for an id selector but a dot(.) is for a class selector. Thank you for this

Thank you very much Najmanager. Now I know why my head hurts on why is the selector is different.(That’s because it’s a different attribute)

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.