Reputation: 12904
Please Check http://jsfiddle.net/4Ly4B/ I've vertical-align: middle
on a table-cell
which is not coming to the middle
Upvotes: 4
Views: 3029
Reputation: 804
The property vertical-align doesn't work with min-height. Remove min-height and add padding instead of it.
.message{
background-color: gray;
position: absolute;
padding-top: 40px;
padding-bottom: 40px;
min-width: 200px;
display: table-cell;
vertical-align: middle;
text-align: center;
}
Upvotes: 0
Reputation:
vertical-align: middle; it's basicall used for table-cell.in your example position is absolute this way u can do this
.message{
background-color: gray;
position: absolute;
min-width: 200px;
display: table-cell;
padding:60px 0px 60px 0px;
text-align: center;
}
Upvotes: 0
Reputation: 349002
An element with display:table-cell
ignores min-width
and min-height
. You have to use height
and width
instead.
Also, if you want to position the element using position:absolute
, you wrap the element in a container, and assign position:absolute
to this container.
See this fiddle: http://jsfiddle.net/4Ly4B/3/
Upvotes: 2