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
Benjamin Hedgepeth
5,672 PointsClearfix hack breakdown
Upon breaking down this code for the clearfix why do the before and after psuedo elements only have one colon and not two colons?
CSS
.cf:before,
.cf:after {
content: " ";
display: table;
}
.cf:after {
clear: both;
}
1 Answer
jcorum
71,830 PointsSupposedly single colons are for pseudo-classes, double colons are for pseudo-elements. So your question is a good one. Here is what CSS Tricks has to say:
"Every browser that supports the double colon (::) CSS3 syntax also supports just the (:) syntax, but IE 8 only supports the single-colon, so for now, it's recommended to just use the single-colon for best browser support.
":: is the newer format indented to distinguish pseudo content from pseudo selectors. If you don't need IE 8 support, feel free to use the double-colon."