This is a discussion on "[SOLVED] Centering an image with CSS without moving anything else on the page." within the Web Page Design section. This forum, and the thread "[SOLVED] Centering an image with CSS without moving anything else on the page. are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
[SOLVED] Centering an image with CSS without moving anything else on the page.
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
[SOLVED] Centering an image with CSS without moving anything else on the page.
Oh, I've looked and searched and all the methods move the menu, or skip a line.
How can I center an image so it's centered in all browsers, on all resolutions, and stay on the same line without affecting anything else? http://www.simplifiedimpact.com/index.html See above, the "SI" logo is centered on my laptop, but not on my desktop. Every method I've tried (placing it within a centered <p> class, depreciated <center>..etc) moves the menu or skips a line, how can it stay on the line it's on and not budge anything else? Surely it's simple? Thanks, Ed
Last Blog Entry: Happy New Year! (Dec 31st, 2007)
|
|
|
|
#2
|
|||
|
|||
|
Re: Centering an image with CSS without moving anything else on the page.
It's really very simple.
Every item that you want to centre should have:
Now everything should be centred in all browsers except IE 5. It's unnecessary to bother with IE 5 (hardly anyone uses it), but if you wish to fix it I can show you the hack. So, why is this failing to work for your logo, yet succeeding for the other two items? Well, <img>s are inline elements. You need to make it display as a block-level element. Inline elements are not formatted in the same way. You can do this with the CSS display: block applied to your <img>. Now it will act as a block box, so the margins will work. |
|
#3
|
|||
|
|||
|
Re: Centering an image with CSS without moving anything else on the page.
Now with me...(yeah I know annoying)
The easier you make it sound, the more confused. If I was to put this directly into css and html what exactly would it look like? Thanks so much, Ed
Last Blog Entry: Happy New Year! (Dec 31st, 2007)
Last edited by Ed; Oct 28th, 2007 at 23:33. Reason: FORGOT to include CSS, making me look stupid. |
|
#4
|
|||
|
|||
|
Re: Centering an image with CSS without moving anything else on the page.
HTML:
|
|
#5
|
|||
|
|||
|
Re: Centering an image with CSS without moving anything else on the page.
Works Perfectly...thank You!
Ed
Last Blog Entry: Happy New Year! (Dec 31st, 2007)
|
|
#6
|
|||
|
|||
|
Re: [SOLVED] Centering an image with CSS without moving anything else on the page.
A pleasure.
|
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Moving image show further up the page to look OK in IE and firefox. | alicanteman | Web Page Design | 2 | Jan 19th, 2008 11:37 |
| [SOLVED] page centering issues | VanderBOOM | Web Page Design | 12 | Dec 4th, 2007 15:06 |
| [SOLVED] image to centre page | R8515198 | Web Page Design | 6 | Nov 23rd, 2007 04:11 |
| [SOLVED] Centering a layer based page for different screen sizes? | Mulith | Starting Out | 11 | Oct 31st, 2007 02:40 |
| Centering an image on my web page | Fysicus | Web Page Design | 8 | Sep 21st, 2007 12:43 |