Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS CSS Selectors Advanced Selectors Pseudo-Elements Challenge

AR Ehsan
AR Ehsan
7,912 Points

Finally, create a new rule that will insert a pseudo-element after an a element.

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.I need help. Whoever helps me i'll vote up for them. Thanks!

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 {
  height: 6px;
  border-radius: 3px;
  background: #d6d7d9;
  position: relative;
  margin-bottom: 3.875em; 
}

a::after{
   content:attr(title); 
  }
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>
a::after{
   content:attr(title);  
  }

This code won't work, you'll need to change

attr(title)

to

attr(href)

3 Answers

Sue Dough
Sue Dough
35,800 Points

Try this :)

/* 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 {
  height: 6px;
  border-radius: 3px;
  background: #d6d7d9;
  position: relative;
  margin-bottom: 3.875em; 
}

a::after{
   content:attr(href); 
  }
AR Ehsan
AR Ehsan
7,912 Points

Hey ghost code! Can you please help me with the quiz after that!

Sue Dough
Sue Dough
35,800 Points

Hopefully. Please open up a new post though.

AR Ehsan
AR Ehsan
7,912 Points

Hey ghost code. Sorry for asking you all those questions. I figured it out. Thanks for all the help.

Daron Robinson
Daron Robinson
9,055 Points

Ghost Code your profile picture is pretty awesome I just had to tell you.

AR Ehsan
AR Ehsan
7,912 Points

How do you post a link

AR Ehsan
AR Ehsan
7,912 Points

Ok! First question:(The___________ pseudo-class matches an element when it's the target of a link.) Second Question:(The top-most element in an HTML document is the_________________________________ element. We're able to target that element with the_________________________ pseudo-class.) third question:(The____________ pseudo-class is called a negation pseudo-class because it doesn't target the elements specified in the argument.) Question 4:(We can use the_____________ pseudo-element to style the first rendered line of text in a paragraph.) Question5:(How is generated content rendered in the browser? Choose the correct answer below: Skip Quiz Review Video Next Question A The pseudo-elements are rendered in the source code. B It's inserted outside an element's box model. C The generated content becomes part of the DOM tree. D It appears as child content before or after an element's content.) Please help me! Thanks!

AR Ehsan
AR Ehsan
7,912 Points

What do you mean