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 trialRob Watson
Courses Plus Student 5,409 PointsHelp needed with CSS Foundations>Relative Length Units- Code Challenge
Hi, I'm stuck on 3/3 of CSS Foundations-Second Edition>Values and units>Relative Length Units-Code Challenge, any help would be greatly appreciated! Q. Select the link with the class 'more'. Using the rem unit, set its font size back to the base font size of the root html element.
Here's my CSS (h1 and p are from the previous questions)...
h1 { font-size:2.5em; } p { font-size:1.5em; }
a class="more"{ font-size:1rem; }
And here's the error message that I'm getting... Bummer! Check the length unit in your CSS value.
Apologies in advance if this is something silly but I've been stuck for a good hour on this trying different things like adding..
html { font-size:1em; }
or changing
a class="more"{ font-size:1rem; }
to
a class="more" href="#" { font-size:1rem; }
But now I'm really stumped! Thanks
Rob
6 Answers
James Barnett
39,199 Points@Rob - I think you are confusing your HTML & CSS markup.
Remember, in CSS you select a class using the .
combinator.
Here's an example:
html
div class="awesome"></div>
css
.awesome { /* css */ }
You can read more about using classes on Shay Howe's Beginner's Guide to HTML & CSS
Guil Hernandez
Treehouse TeacherHi Rob,
You're close. When using a class selector, you need to use the "." character before the class name. HINT: the a
and class=" "
aren't necessary.
Rob Watson
Courses Plus Student 5,409 PointsThanks for the quick reply, much appreciated! It seems obvious now, all sorted. I think you must have fried my newbie brain earlier today with Structural Pseudo Classes!
Rob Watson
Courses Plus Student 5,409 PointsYes James, I think you're right about my confusion. Too much too soon, back to basics I think! Thanks for your example.
James Barnett
39,199 Points@Rob - Here's a great introduction to classes & IDs
Let us know if this thread if you've got any more questions about using classes (or IDs).
James Gill
Courses Plus Student 34,936 PointsHmm. Here's my code from that challenge, and it's failing with the same error message. Strangely, it works for me outside the Treehouse environment. Am I missing a detail?
/* Write your CSS code below */
h1 {font-size: 2.5em;}
p {font-size: 1.5em};
.more {font-size: 1rem};