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

KaWai Guo
KaWai Guo
2,788 Points

vertical-align

how are beginner coders suppose to know about the vertical-align property?? That part was really frustrating me!

I never used vertical-align, it's annoying and it never works like i want it to work.. for example "vertical-align: middle;". I rather use "line-height: 2em" to center my text. Followed by "white-space: nowrap;". I would like to know a good use for vertical-align... Maybe a mod has an idea :)

1 Answer

Rui Dias
Rui Dias
3,788 Points

vertical-align only applies to inline and table-cell elements. To align in a block I also like to use the line-height property, setting also the height, ex: div { height: 100px; line-height: 100px; }