Topic: Horizontal Centering of Images (Page 1 of 1) |
|
---|---|
Nervous Wreck (II) Inmate From: Dublin, Ireland |
![]() 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 |
![]() Look at the CSS I use to center #content at http://www.runningwolf.com/ |
Nervous Wreck (II) Inmate From: Minnesota |
![]() 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 |
![]() Images can be centered in the normal way. |
Nervous Wreck (II) Inmate From: Minnesota |
![]() Here's an example of margin-auto not centering an image. code: #centeredImg {
|
Nervous Wreck (II) Inmate From: Dublin, Ireland |
![]() 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 |
![]() margin: auto won't work in IE. |
Bipolar (III) Inmate From: Cold Sweden |
![]() |