The following are links to additional questions that our community has asked about this exercise:
This list will contain other frequently asked questions that aren’t quite as popular as the ones above.
Currently there have not been enough questions asked and answered about this exercise to populate this FAQ section.
This FAQ is built and maintained by you, the Codecademy community – help yourself and other learners like you by contributing!
Not seeing your question? It may still have been asked before – try searching for it by clicking the spyglass icon () in the top-right of this page. Still can’t find it? Ask it below by hitting the reply button below this post ().
What is the difference between id and class?
I tried using the following in the index page:
h1 id=“title”>Top Vacation Spots</h1
and then use the below in the css page: #title {
color:teal;
}
I got the same result.
So, what is the difference between these and when to use one instead of the other?
If there are, for instance, a number of p elements in the html page, how can I select specifically one of them in the css page to style only that one? Do I inevitably need to write the attribute of the element to do that?
If ID takes precedence over Class, then is they any real world use for Class attribute?. That’s to say why not just use ID in place of Class when selecting a specific element?
ID is used to target specific elements for styling and they are unique to the elements they have been assigned to (meaning a particular ID can’t be used more than once). Whereas Class can be used with multiple elements, this is used to style these elements at once.
So to answer your question regarding the usefulness of Class, it would be easier to set a Class to a group of elements for similar styling than to set a unique ID to each of these elements and have to style them one after the other.
Why is the Syntax .ExampleClass ? Why was it decided, that the best way to recognize classes is to put a dot in front of them? Seems a bit confusing on first glance
If I want to target the same elements like p for example, but with different class and I want to change their style all together, can I write the CSS code like the example?
HTML
p class=“brand”
p class=“story”
p class=“news”
I was literally about to post the same cropped screenshot
I looked for differences in the code in both html and css. Just a site bug I guess. I had to use the “replace with solution” button to get past the exercise.