Possible Duplicate:
Best practice vertical-align center content on div
How can I vertical align center .content for the both squares using same CSS.
Thanks
Possible Duplicate:
Best practice vertical-align center content on div
How can I vertical align center .content for the both squares using same CSS.
Thanks
Here's the solution -> http://jsfiddle.net/Sha6m/12/.
You need to add display: table-cell;
to the inner .content, set their vertical-align to middle (vertical-align: middle;
) and give them the same height
and width
of their parent .area (100% width and height unfortunately don't work here, so when you alter the .area
's height and width, you also have to do it for the .content div).
style='vertical-align:middle'
..
You're applying display table-cell
to the wrong elements. You have to wrap them in a container, and apply display: table cell
to that container. Check my example -> http://jsfiddle.net/Sha6m/10/
When u got a fixed height i would just add a line-height: 100px;
and remove your vertical-align
and display