Click to See Complete Forum and Search --> : Centering the image in the div


vimala
01-28-2009, 08:34 AM
Hi...

I want to paste my image inside the center of the background.

Can anybody help me...

My coding is below...
<style>
.photoBg {
width:165px;
height:130px;
float:left;
background-image:url(../../images/orange/img_email_album1.jpg);
background-repeat:no-repeat;
background-position:center middle;
}
</style>

<div style="float:left;">
<div class="photoBg" style="float:left;" align="center">
<div align="center" style="text-align:center; display:table-cell; vertical-align:middle; padding-top:35px;">
<img src="http://192.168.1.230/cpb/photovol/volume1/webpics/medpics/05/96/1_1859_1232792573md7005f9396b718aeb2f9f14f84a67e998.jpg" border="0" width=100 height=67>
</div>
</div>

Fang
01-28-2009, 09:44 AM
That centering will only work in browsers that understand display:table-cell
http://www.wpdfd.com/editorial/thebox/deadcentre4.html
http://www.student.oulu.fi/~laurirai/www/css/middle/