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


Oleg Mogytych
Oleg Mogytych
10,684 Points

Using display:table instead of float+clearfix

I suggest as better solution for adjusting the article+image overflow. For this task, as for me, it's not optimal with smaller widths. Because it brakes on smaller devices Please check and explain, why should we use floating function instead of table in this case.

My solution -

.article-content { display:table; }

provide result


your solution

.article-content { float:right; width:78%; }

provide result https://prnt.sc/op1jzt

1 Answer

Caroline Hagan
Caroline Hagan
12,612 Points

Using display: table becomes less convenient as your layouts get more complex, and it can get messy to work with in responsive layouts. display: table works best with small sections of a page, rather than major layout sections.

Better yet - depending on the use case - would be to use the new CSS Grid, or Flexbox. But if you're simply floating an image in some content, I prefer Nicole Sullivans media object: http://www.stubbornella.org/content/2010/06/25/the-media-object-saves-hundreds-of-lines-of-code/