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 Make an About Page

Luise Steinkellner
Luise Steinkellner
671 Points

Class selectors are not working/ reacting

I have just created a class selector in my css which isn't being applied (I've had the same problem previously but asked the wrong kind of question). I seem to be something wrong in naming or selecting my class.

Here's the html

img src="img/nick.jpg" alt="Photograph of trainer Nick P." class="profile-photo"

and the css

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

When I look in the browser none of the profile-photo styling is applied/working.

Thanks in advance!

Luise, can you give us a copy of the entire img element, including the < and >?

1 Answer

Lars Jönsson
Lars Jönsson
2,965 Points

Maybe you might get up one level from the CSS folder (if you have the CSS file in a seperate folder than your index.html),

try

<img src="../img/nick.jpg" alt="Photograph of trainer Nick P." class="profile-photo">
Luise Steinkellner
Luise Steinkellner
671 Points

James, Lars,

thanks a lot for your help. Emptying the caches in Safari seems to have done the trick. James, I tried to add all the html elements in my question but then none of the html was displayed. No idea why this happened. Thanks again both of you