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!

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


Why use 'display: table' in a clearfix?

In the CSS Layout Techniques - The Float Clearfix video, Guil uses a clearfix for the main header element by adding a pseudo element after the main header, giving it blank content, using 'clear: both;'.

I understand why he does this, but I don't understand why he gives it display: table;. Can anyone explain why?

.group::after { content: " "; display: table; clear: both; }

(the main header element has the class 'group' in the html)

1 Answer