PDA

View Full Version : How to centre a image in a div ?


Rajweb
08-08-2009, 01:54 PM
I have a dive box 100px x 100px with a 1px border

I have a image W38 H50

I want to centre the image in the div box, yet so far it eludes me :)

help appreciated

:)

MagicPower
08-09-2009, 07:50 PM
are you planning to add content (e.g text in the same div)? Whatever it is anyway i would say giving that image a new css rule and then give the rule som margin or if not display:block and then add some padding to it and fit it exactly where you want it to be.

domedia
08-09-2009, 08:29 PM
use the CSS background property.