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 trialCeci Kellen
4,749 Points: vs ::
In the example in this video, the CSS code used to generate clearfix is:
.group:after { content: ""; display: table; clear: both; }
In additional resources, https://teamtreehouse.com/library/css-selectors/advanced-selectors/pseudoelements-before-and-after, the CSS code used to generate clearfix is:
.jpg::before { content: ""; font-size: 0.75em; }
What's the difference between using a single : vs a double :: ?
1 Answer
Iain Simmons
Treehouse Moderator 32,305 Points::
(double colons) are used for pseudo-elements (think, anything where you use the content
property), while :
(single colon) is used for pseudo-selectors (selecting an existing element based on certain criteria, like :hover
if the user's mouse is hovering over it, or :first-child
if it's the first child element of a parent.
Using single colons for pseudo-elements is still supported in all browsers for backwards compatibility, so everything will still work if you just use single and forget which is which.