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

CSS

Caption boxes in "How to Make a Website"

I would like to make all the caption boxes the same size but if a caption takes up more than one line, it makes the caption box taller than all the other ones. This makes them all not line up correctly and it's really bugging me. Any suggestions?

1 Answer

You could add a max-height or set height to the boxes.

max-height will not allow the boxes to be higher than the value you set. But if the height of the text is less the max-height you define it will not fill up the entire height of the space (if that makes sense). Height will set all the boxes to your specified height regardless of the size of the content inside of it.

But beware, if the height of your text is greater than the height of your box it will overflow outside of the box.

You could stop this from happening by setting the overflow property to hidden (any text that falls outside of that height will be completely cut off) or scroll (the content will be scrollable within the height you set).