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

HTML How to Make a Website Adding Pages to a Website Style New Pages

Christy Zimmer Coyle
Christy Zimmer Coyle
3,014 Points

Why isn't this code working?

.profile-photo { display: block; max-width: 150px; margin: 0 auto 30px; border-radius: 100%; }

When I save and refresh Workspace, it doesn't look like any of this code is working. The profile picture hasn't changed at all. As far as I can tell it's identical to what's in the video. Please help!

Thank you.

9 Answers

Markus Ylisiurunen
Markus Ylisiurunen
15,034 Points

You have missed quotation marks from alt attribute.

Something like this should work:

  <img src="img/nick.jpg" alt="Photograph of Nick Pettit" class="profile-photo">

EDIT: Sorry I somehow missed your class attribute.

Sjors Theuns
Sjors Theuns
6,091 Points

Hi Christy,

put the alt text between quotes, like: <img src="img/nick.jpg" alt="Photograph of Nick Pettit" class="profile-photo">

Linda Catling
Linda Catling
2,600 Points

Never mind -- problem solved. I was missing a space between the class="" and the >

Markus Ylisiurunen
Markus Ylisiurunen
15,034 Points

Hi!

Your css looks just fine. I can't find any mistakes. Do you have any other css going on so you know that your styleheet is correctly linked to HTML document?

If it is linked correctly then you should check if there is something wrong in your HTML. If you cannot find anything, you can post your code here.

Also next time check Markdown Cheatsheet to see how to add your code to your posts correctly.

Christy Zimmer Coyle
Christy Zimmer Coyle
3,014 Points

Thank you for your quick reply Markus.

I will definitely check my HTML.

Just so you know, I did check and follow the directions in the Markdown Cheatsheet but it didn't work either. I'm already fairly frustrated so it's quite possible I missed something there.

Markus Ylisiurunen
Markus Ylisiurunen
15,034 Points

No problem!

Can you please post your HTML code here so members can also try to find a solution for your problem. Are you sure that your stylesheet is in the right folder? That could break a link.

Christy Zimmer Coyle
Christy Zimmer Coyle
3,014 Points
  <img src="img/nick.jpg" alt=Photograph of Nick Pettit class="profile-photo">

Here's the HTML code. I think this might be the problem, but I can't quite figure it out. Any help would be great!

I think my stylesheet is in the right folder. Everything else has worked up to this point.

Christy Zimmer Coyle
Christy Zimmer Coyle
3,014 Points

Yup, that did it!

Thank you Markus and thank you Sjors very much!

Linda Catling
Linda Catling
2,600 Points

Hi, I'm having the same problem as Christy.

When I scroll through the messages I here the final two are Christy's code and the next message that says "Yup, that did it!"

What was the solution? Is there a message I'm not seeing, or was it the problem with the style-sheet being in the wrong folder?

Thanks!