![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello All, I'm getting stuck on how to get an image to centre inside a DIV. When a page is displayed in IE, div style='text-align:center;' img ... /div does the job as IE handles the image as if it were text However in firefox / chrome / safari etc the image sits on the left. Is there a foolproof centre for the div containing an image? I have read somewhere about using style='margin:auto;' but that doesn't seem to work. Any suggestions welcome. |
#3
| |||
| |||
|
|
Ron Barnett wrote on 20 jan 2009 in comp.infosystems.www.authoring.stylesheets: Hello All, I'm getting stuck on how to get an image to centre inside a DIV. When a page is displayed in IE, div style='text-align:center;' img ... /div does the job as IE handles the image as if it were text However in firefox / chrome / safari etc the image sits on the left. Is there a foolproof centre for the div containing an image? I have read somewhere about using style='margin:auto;' but that doesn't seem to work. Any suggestions welcome. http://www.google.com/search?q=image+center+margin.auto+css -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress) |
#4
| |||
| |||
|
|
I ended up putting style='padding-left:auto;padding-right:auto;text-align:center;' in the containing DIV. The padding makes standards compliant browsers center, while IE responds to the text-align. |
![]() |
| Thread Tools | |
| Display Modes | |
| |