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

CSS CSS Selectors Advanced Selectors Pseudo-Elements Challenge

Robbie Singh
Robbie Singh
3,675 Points

Challenge Question Regarding Advanced Pseudo Class Selectors....Read More

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.

Not sure what to do here.

style.css
/* Complete the challenge by writing CSS below */

.progbar::after {
  content:""
  display: block;
  width: 50%;
  height: 100%;
  border-radius: inherit;
    background-color: #5ece7f; 
}

.progbar::before {
  content:""
    display: block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    position: absolute;
    left: 49%;
    top: -9px;
    background-color: #7dd898; 
}

.progbar::a:: after {
  content:attr(href);
  height: 6px;
  border-radius: 3px;
  background: #d6d7d9;
  position: relative;
  margin-bottom: 3.875em; 
}
index.html
<!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>

You need to look at .progbar::a:: after again. Try the format below.

.progbar a:after { content: " (" attr(href) ")"; }

Robbie Singh
Robbie Singh
3,675 Points

Hey Joseph, well I tried that but it tells me to specifically use a double colon. After makes those adjustments, it says "Make sure you're using the CSS function that generates the value of an attribute."

1 Answer

Your .progbar:after and .progbar:before are correct. Don't forget to put semi colons after your content properties though. One thing to note is that the final class in your css file shouldn't be changed. The task is asking you to insert a pseudo element after an anchor element which is unrelated to the .progbar classes.

Try addressing anchor elements on their own like this:

a::after {
    content: attr(href);
}