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 trialtian jin
Courses Plus Student 5,162 Pointstable display is good for vertical align?
Can I just simply use vertical-align property to achieve the same result? what's the difference?
1 Answer
bleedcmyk
5,945 PointsYou can only vertical-align inside certain elements, a table being one of them. For div's, you can use something like this for middle alignment.
.div {
position: relative;
top: 50%;
transform: translateY(-50%);
}
There are multiple ways of achieving the same result, and they all have their own pros and cons.