Class Selector


#1

On exercise 5, I am being asked to add a class selector for the class partner. I am, but I'm not sure exactly what I'm doing wrong. Here's my code:

.partner
{
  font-family: Georgia, Times, serif;
}

#2

Could you please post a link to the exercise? What error are you getting?

It's not much but you could try this instead

.partner {
  font-family: Georgia, Times, serif;
}

(Wouldn't change anything outside of Codecademy, but on here it might...)


#3

Here it is: https://www.codecademy.com/courses/learn-html-css/lessons/ids-classes-divs/exercises/class-selectors-i?action=lesson_resume&link_content_target=interstitial_lesson

I tried that, but it didn't change anything because that is just personal preference. It doesn't affect the code. I tried moving this segment of the code right above the h4 code because on the lesson it says the class selector is immediately followed by the name of the class. So I'm guessing that h4 segment is the name of the class?


#4

Yes, as explained, it shouldn't change anything, but on Codecademy you never know with these things.
It was a long shot, but let's move on to something else.


This is the instruction:

1. Scroll through style.css and add a class selector for the class partner.

and the given CSS, untouched so far:

/* Add the class selector to this CSS rule */

 {
  padding: 20px;
  text-align: center;
  margin: 0 auto;
  border-bottom: 1px solid #EEE;
}

.partner img {
  position: relative;
  top: 6px;
}

You basically only need to add .partner, as you did, to get this:

.partner {
  padding: 20px;
  text-align: center;
  margin: 0 auto;
  border-bottom: 1px solid #EEE;
}

And that's it, hit run and you should be good to go.


Why did you modify the code to this?

.partner
{
  font-family: Georgia, Times, serif;
}

Try resetting the exercise and follow the steps, without modifying the code.

If it still doesn't work, try using another browser for this exercise. Might be a glitch.


#5

Thank you so much! How did you know that I needed to add it to that particular segment? And I modified the code to that by mistake.

Also, now it's saying to add the ID selector to this CSS rule but I don't remember what I had there because I refreshed it. Here's the link: https://www.codecademy.com/courses/learn-html-css/lessons/ids-classes-divs/exercises/class-selectors-i?action=lesson_resume&link_content_target=interstitial_lesson


#6

Thank you so much! How did you know that I needed to add it to that particular segment?

My pleasure. And you can figure it out with indications such as

/* Add the class selector to this CSS rule */ ---> This is basically telling you where to look,

and also...

 {
  padding: 20px;
  text-align: center;
  margin: 0 auto;
  border-bottom: 1px solid #EEE;
}

... because it had no selector, which simply can't happen.

And finally, because the following selector was this

.partner img {
  position: relative;
  top: 6px;
}

Also, now it's saying to add the ID selector to this CSS rule

Same idea applies here. Except you won't be putting a class selector, but an ID selector, which is this:

#


#7

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