Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-22-2007, 04:31 PM   PM User | #1
wsammy
New Coder

 
Join Date: Sep 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
wsammy is an unknown quantity at this point
images dont listen to margins

have a problem.
I want to center my page and was told to put my margins as {margin-right: auto; margin-left: auto;} I have done this and my text centers in the middle of the page. my images however do not do this.

my css looks like this:

#containertext {
margin-left: auto;
margin-right: auto;
width: 500px;
}

#green {
top: 390;
left: 120;
}

#carbon {
top: 270;
left: 480;
}

#lib {
top: 255;
left: 210;
}

#yougov {
top: 250
}

#iraq {
top: 390;
left: 380;
}

#bodytext {
top: 20;
}

#green, #carbon, #lib, #yougov, #iraq, #header, #bodytext {
position: absolute;
}

and i have put a division with the id of "container" around the whole page.
Does anyone have the answer?
wsammy is offline   Reply With Quote
Old 09-22-2007, 05:12 PM   PM User | #2
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
Could you post the page code or link to it so we can see how the images are set?
gnomeontherun is offline   Reply With Quote
Old 09-22-2007, 05:13 PM   PM User | #3
rmedek
Senior Coder

 
Join Date: Nov 2003
Location: Minneapolis, MN
Posts: 2,879
Thanks: 2
Thanked 65 Times in 56 Posts
rmedek is on a distinguished road
Images are inline elements—which don't respond to margins—and so you need to declare them block-level elements first…

Code:
img {
 display: block;
 margin: 0 auto;
}
Hope this helps…
__________________
drums | web
rmedek is offline   Reply With Quote
Old 09-22-2007, 05:18 PM   PM User | #4
wsammy
New Coder

 
Join Date: Sep 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
wsammy is an unknown quantity at this point
Thanks

Quote:
Originally Posted by rmedek View Post
Images are inline elements—which don't respond to margins—and so you need to declare them block-level elements first…

Code:
img {
 display: block;
 margin: 0 auto;
}
Hope this helps…
Thanks that was really helpful.
wsammy is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:08 PM.


Advertisement
Log in to turn off these ads.