#someDiv div {display: table-cell; vertical-align: middle}
-----------------------
To horizontally center as well, give the img element a style of:
-----------------------
display:block;
margin-left:auto;
margin-right:auto;
------------------------
joyaz711
2007-08-10 21:30:01 UTC
There is no way to vertically align in a div - in a table cell the default is to align in the middle.
With the div, you could set the background image as the bananas like this....
Text or content for the div, if any, goes here.
(had to split it to separate lines to get the code to show here) Give that a try and see if that's what you're trying to do.
Joyce
http://www.DesignByJoyce.com/
I.M.
2007-08-10 22:06:58 UTC
as long as U don't have to size of a HTML page U can't do that but U can simply create a table that the width and height of it is 100% then create a cell on it on the only row of it and make this cell valign = middle
zircon
2007-08-10 21:20:15 UTC
Jaren S
2007-08-10 21:11:36 UTC
ⓘ
This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Continue reading on narkive:
Search results for 'how do i vertically a picture in html?' (Questions and Answers)