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

08-08-2009, 12: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


08-09-2009, 06: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.

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