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 trialjames white
78,399 PointsCSS Selectors Advanced Selectors Pseudo Elements Challenge (4 parts)
Link to Challenge:
http://teamtreehouse.com/library/css-selectors/advanced-selectors/pseudoelements-challenge
Challenge Task 1 of 4
Let's use pseudo-elements to create a progress bar from a single element. First, in the top .progbar selector, add the pseudo-element that will insert content after the progbar element.
Challenge Task 2 of 4
In the same rule, add the property that lets us insert content into an element. The value should be an empty set of quotes.
Challenge Task 3 of 4
Next, in the second .progbar selector, add the pseudo-element that will insert content before the progbar element. Don't forget to write the content declaration on line 13.
Challenge Task 4 of 4
Finally, create a new rule that will insert a pseudo-element after an a element. As the content value, define a CSS function that will insert an href attribute's value as content.
First of all this is NOT a beginner course
Should a course be called a "beginner" course if it has a section
called: "Advanced Selectors"?
Secondly there are only a handful of Treehouse forum threads on this brand spanking new course at this point:
https://teamtreehouse.com/forum/syllabus:1142
..and this challenge is the hardest of all of them for the course.
The toughest part of the first 3 challenges is that there isn't a lot of pseudo element selectors code out there are the internet and the words used in the question where relatively generic, making google search keyword "hits" difficult.
The last part left me guessing, but I figured it was something to do with 'attr' since it was the last thing discussed and they really didn't challenge test it anywhere else but in this last challenge.
This two pages provided code snippets that where close:
This page:
http://davidwalsh.name/css-content-attr
..provided a similar word matching to the challenge question:
In the case that you'd like to use an element attribute as content (this being the dynamic usage of content), you may do so with the attr expression
This page:
http://www.w3schools.com/cssref/pr_gen_content.asp
..gave me a reasonably close attr code snippet::
a:after {
content: " (" attr(href) ")";
}
So in the end the code to pass all the parts of the challenge turned out to be:
/* Complete the challenge by writing CSS below */
.progbar {
---
}
.progbar {
---
}
.progbar {
height: 6px;
border-radius: 3px;
background: #d6d7d9;
position: relative;
margin-bottom: 3.875em;
}
//the line that made me think a little..
---
Some helpful links for the earlier challenges:
https://teamtreehouse.com/forum/attribute-selector-with-img-test-question-is-failing-my-answer
http://www.w3schools.com/cssref/css_selectors.asp
http://css-tricks.com/pseudo-element-roundup/
http://css-tricks.com/almanac/selectors/a/after-and-before/
https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors
https://developer.mozilla.org/en-US/docs/Web/CSS/Child_selectors
https://developer.mozilla.org/en-US/docs/Web/CSS/Adjacent_sibling_selectors
https://developer.mozilla.org/en-US/docs/Web/CSS/General_sibling_selectors
9 Answers
Guil Hernandez
Treehouse TeacherThanks for the suggestions, james white. But please, don't take away all the fun by posting quiz and code challenge answers on the forum. :)
Dekin O'Sullivan
10,749 PointsGuil I don t agree: most are challenging and there is nowhere else where answers are to be found. So if one can't make it through the questions we are left with... nothing. Which would be a shame. I think there should be answers provided with the tests if one wants them (one would for example not get any points for hitting the "answer" button). Not having answers available on these challenges is one of the most frustrating things about the courses... Hope you guys can fix that...
Agustin Grube
39,278 PointsFun? lol
This is a tough one that I've comeback today to finish. Granted, the answer is not readily available in the downloads or in the videos. In other courses here, I've had to search outside resources to complete some challenges. But I do agree with James White on this one.
Alexandre Basso
4,134 Pointsfinnally it is done!
Jalen Taylor
15,162 PointsI don't see the answer to the third task on here.
Alexandre Basso
4,134 Pointslook at the video lesson and you will have the answer
Richard Targett
4,960 PointsGoogle got me here.
HINTS option would be nice, treehouse. I dont just copy/paste though, Gil, so I [am] learning. I google it, look at why, when, and how, then implement it. Sometimes though it [is] hard not to know where to look and all you have to go for is a red alert message.
Never complaining as I [do] love this site, but a HINTS option could certainly help.
Agustin Grube
39,278 PointsActually the answer to the 4th task is in the videos so pay attention.
Guil Hernandez
Treehouse TeacherHi Agustin Grube,
Yep, the answer is in the videos and in the teacher notes. Nice work!
I’ve taken web dev code challenges on here from other teachers that took me days to figure out, and had me refer back to the language documentation. Being challenged, along with complexity and that connection between effort and reward are part of what makes learning web design and development fun & satisfying. :)
Richard Targett
4,960 PointsGoogle got me here.
HINTS option would be nice, treehouse. I dont just copy/paste though, Gil, so I [am] learning. I google it, look at why, when, and how, then implement it. Sometimes though it [is] hard not to know where to look and all you have to go for is a red alert message.
Never complaining as I [do] love this site, but a HINTS option could certainly help.
Gavin Mace
30,747 PointsJust went through this one,
I disagree with OP, I think pretty much all of the code challenges are wayyyyy too simple, especially if you're actually wanting to learn the languages and have a career as a developer.
In a university exam, or in the real world, I don't imagine anyone would be as forgiving with mistakes as treehouse code challenges are.
Ken Alger
Treehouse TeacherKen Alger
Treehouse TeacherMr. White;
Did you have a question about this challenge?
Ken