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 trialAlistair Mackay
7,812 PointsPseudo-Elements Challenge (Part 2) - Not sure what I'm missing to make this challenge pass.
I'm stuck on the second task in this challenge that asks:
"In the same rule, add the property that lets us insert content into an element. The value should be an empty set of quotes."
I'm fairly certain the "attr()" is the key to this exercise but the error message:
"Bummer! Make sure you're defining the correct value for 'content'." Is making me thing otherwise.
I cam across another link in the community to this post but I still couldn't find the exact answer to pass the code.
I've tried the following:
.progbar::after {
content: attr ();
display: block;
width: 50%;
height: 100%;
border-radius: inherit;
background-color: #5ece7f;
}
and
style.css
.progbar::after {
content: attr ("");
display: block;
width: 50%;
height: 100%;
border-radius: inherit;
background-color: #5ece7f;
}
Still nothing, I know I'm missing something, I just can't see it...
/* Complete the challenge by writing CSS below */
.progbar::after {
content: attr("");
display: block;
width: 50%;
height: 100%;
border-radius: inherit;
background-color: #5ece7f;
}
.progbar {
display: block;
width: 24px;
height: 24px;
border-radius: 50%;
position: absolute;
left: 49%;
top: -9px;
background-color: #7dd898;
}
.progbar {
height: 6px;
border-radius: 3px;
background: #d6d7d9;
position: relative;
margin-bottom: 3.875em;
}
<!DOCTYPE html>
<html>
<head>
<title>Selectors</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="page.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="progbar"></div>
<a href="http://teamtreehouse.com">Check out the URL: </a>
</body>
</html>
3 Answers
alastair cooper
30,617 Points.progbar::after {
display: block;
width: 50%;
height: 100%;
border-radius: inherit;
background-color: #5ece7f;
content:"";
}
I think the attr() function is for use with jQuery.
Alistair Mackay
7,812 PointsCheers for that, how do you get the code to show up correctly in the comment section?
alastair cooper
30,617 PointsSee the markdown cheatsheet at the bottom of the page. Basically whenever you want it to write as code, use the button that looks like an apostrophe 3 times with a blank line before and after. Then type your code and then repeat the 3 square apostrophes.
This is explained better on the cheatsheet below
Jose A Reynaldo Vazquez
21,313 PointsThis is the correct answer: .progbar::after { content:""; display: block; width: 50%; height: 100%; border-radius: inherit; background-color: #5ece7f; }
Alistair Mackay
7,812 PointsAlistair Mackay
7,812 PointsI jumped the gun a bit on this problem, by assuming to much. I thought the question was asking me for the "attr()" value. When in actual fact all the question wanted from me was the "content:" property.
/Facepalm
If your here reading this then, this is what the question was looking for.
References used in the community forum to reach conclusion and /facepalm moment: https://teamtreehouse.com/community/final-challenge-in-css-selectors https://teamtreehouse.com/community/finally-create-a-new-rule-that-will-insert-a-pseudoelement-after-an-a-element-as-the-content-value-define-a-css-func
-PC