Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS How to Make a Website Adding Pages to a Website Add and Style Icons

James Male
James Male
6,619 Points

I cant don't understand what I am doing wrong...

Task:

Select the unordered list with the class contact-info and set the font size to 0.9em. Then, remove all margin, padding, and list styling.

My Code:

.contact-info ul { font-size: 0.9em; margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px; list-style: none; }

4 Answers

Tom Bedford
Tom Bedford
15,645 Points

Hi James

Your current code is trying to select an unordered list inside another element with the class "contact-info". You want to select an unordered list -with- the class of "contact-info".

This code selects any element with a class of "example":

.example {
  color: red;
}

This code only selects paragraphs with the class "example":

p.example {
  color: red;
}

This code selects paragraphs inside another element with the class of "example" (this is similar to what you are trying at the moment):

.example p {
  color: red;
}

Hope this helps you figure it out!

Just try

.contact-info {
font-size: 0.9em;
margin: 0px;
padding: 0px;
list-style: none;
}

Hi James, you just need to swap the selector and the class around, so you end up with the code below:

ul.contact-info {
  font-size: 0.9em;
  margin: 0px;
  padding: 0px;
  list-style: none;
}
Tom Bedford
Tom Bedford
15,645 Points

I think this would select elements inside an unordered list with the class "contact-info" rather than an unordered list -with- the class "contact-info".

edit: you've corrected it, awesome!

Thanks Tom - realised the typo and changed it (was hoping before anybody noticed it but you're quick off the mark!)

James Male
James Male
6,619 Points

Thanks Tom and Jordan, I understand now that the problem was with me mis-reading the task as opposed to my code. I will adjust my code to target the correct element on the page. Thank you for you help.

As I am new to Treehouse can you please explain to me How I close this post? Or do I leave it for others to look and learn from?

Thank in advance,

  • James
Tom Bedford
Tom Bedford
15,645 Points

Glad you've got it sorted!

There should be an option to select a "best answer", doing so will mark the thread as "answered".