Topic: Horizontal Centering of Images (Page 1 of 1) |
|
---|---|
Nervous Wreck (II) Inmate From: Dublin, Ireland |
posted 11-27-2003 13:52
OK, this is driving me mad. I want to center a single image horizontally at the top of a page, using CSS. I've read various posts on this forum, seached the internet, tried numerous suggestions, all with no luck! Finally I found this, from Suho1004 last year: quote: |
Paranoid (IV) Inmate From: 127.0.0.1 |
posted 11-27-2003 15:02
Look at the CSS I use to center #content at http://www.runningwolf.com/ |
Nervous Wreck (II) Inmate From: Minnesota |
posted 11-27-2003 19:23
You can wrap the image in a div, and give that text-align: center code: margin-left:50%;
|
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 11-27-2003 19:29
Images can be centered in the normal way. |
Nervous Wreck (II) Inmate From: Minnesota |
posted 11-28-2003 03:06
Here's an example of margin-auto not centering an image. code: #centeredImg {
|
Nervous Wreck (II) Inmate From: Dublin, Ireland |
posted 11-28-2003 09:12
You've cracked it! It was the simple auto margin method I was trying to get to work, and as Slime said you've got the have the right doctype - I had HTML 4.0, which is obviously well out of date. I really must get a more up-to-date editor! |
Maniac (V) Mad Scientist with Finglongers From: Cell 53, East Wing |
posted 11-28-2003 15:10
margin: auto won't work in IE. |
Bipolar (III) Inmate From: Cold Sweden |
posted 11-28-2003 19:38 |