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

HTML

Need help aligning text under images.

Hello,

I have two rows of four images and I'm trying to align text under each image. The text is in unordered lists. I also need the text to wrap, some ul's have more text than others. I've been trying to figure this out but I'm stuck.

I tried wrapping the first four h3's and ul's in one div.

<div style="text-align: justify">.

This code four times, wrapped in the div above.

<h3>Text</h3> 
    <strong>Text</strong>
    <ul>
      <li></li>
      <li>More text</li>
      <li>More text</li>
      <li>More text</li>
      <li>More text</li>
   </ul> 

I then tried wrapping them in individual divs <div style="text-align: justify">.

Does anyone know which Treehouse course covers this?

CSS for images:

div {
    text-align: justify;
}

div img {
    display: inline-block;
    width: 180px;
    height: 250px;
    border-radius: 20px;
}

div:after {
    content: '';
    display: inline-block;
    width: 100%;
}

This works perfectly for the images, now I need the text to align and wrap properly.

Thanks

Correct formatting added :)

1 Answer

Check this out! I hope this is what you need.

https://jsfiddle.net/Fibonacci_Spiral/vjbywxxt/

Thanks Ethan, this helped!