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

Css styling of list items containing h1, img and p elements.

Hi, so I'm working on the stylesheet of a Wordpress template that would show a set of posts in a 3x2 list. Each list item contains, the title of the post, an image, and an excerpt.

Now my problem is that I want to have each element aligned at the same hight with the others of the same kind. So all titles aligned, all images aligned, and all excerpts aligned.

So far I have not managed to do so as you can see here: http://www.mediafire.com/view/f6bakwcw1jpiywq/misaligned%20li.png

What could I do to align each element with the others? Is it even possible?

Thanks in advance!

2 Answers

Hello Diego,

maybe you can try setting heights for h1, images, and p elements.

Hey Diego,

One thing I think you could do but may not be your perfect solution would be to have the image on top of the h1. This would make the layout a lot more even.

You could also just shrink the font size of the h1 a little bit to make those longer words fit on the line. Wouldn't go too crazy on this though.

You could also do this, but will clip whatever text goes over the width of the container it is in:

h1 { overflow: hidden; white-space: nowrap; }

Personally I would go for the first solution and let the text/content dictate rather than the design.