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

Konrad Pilch
Konrad Pilch
2,435 Points

What is this used for?

HI, what are the dotted :collumns: used for ?

.wrapper:before, .wrapper:after {
    content: "";
    position: absolute;
    top: 5px;
    left: -5px;
    width: 100%;
    height: 100%;
    background: #97917e;
    z-index: -1;
}

.wrapper:before {
    top: 10px;
    left: -10px;
    background: #514933;
}
Jennifer Hughes
Jennifer Hughes
11,421 Points

:before and :after are CSS pseudo classes. Pseudo classes and pseudo elements allow you to apply style to elements in relation to the document tree and in relation to external factors, such as if a link has been visited or if a mouse is hovering over an element.

:before is a pseudo class that applies style BEFORE an element, and :after applies style after the specified element.:

Say you wanted to add an image of a phone before a telephone number. You could do this by selecting the element of the telephone number and using the ::before pseudo class. Let's give our phone number the class of "phone". So, we could do:

.phone::before {
    content: "\2706"
}

\\ "\2706" is a common unicode value for an image of a phone.

There are several other pseudo classes you can familiarize yourself with via a quick Google search. I hope this has helped some!

1 Answer

Andrew Sena
Andrew Sena
7,851 Points

If you are talking about the ":" in ".wrapper:before" it is a CSS selector which will add the specified CSS property before every wrapper class and after in ".wrapper:after". Hope this helped.