Topic: Centering an Image within a Block Element |
|
---|---|
Author | Thread |
Obsessive-Compulsive (I) Inmate From: |
posted 02-13-2005 03:10
I am trying to center an image within a div container on my page. The css code addresses this goal with margin-left: auto; margin-right: auto; text-align: center; the style is conveniently called div.ImageCenter. Now, I need to wrap my head around block level elements and how they influence the alignment. The CSS rule centers the div container within a block element rather than the ID container (#MainContent). In addition, my ArticleID float affects the block element?s right margin. I added a 1 px red border to illustrate the block level elements. As you can see, the image (excludes icon images) centers within the border; yet the border does always extend the full width of the #MainContent container. The <UL> tags influences the block level element or overall width used in the centering the div container. The situation has me all confused about the CSS logic. |
Bipolar (III) Inmate From: New York, USA |
posted 02-13-2005 07:03
For 1, you need to check out your page in IE, your nav is off and the margin auto doesn't work in IE. The best way to center a div in all browsers is using code: margin-left:50%;
|
Bipolar (III) Inmate From: New York, USA |
posted 02-13-2005 07:07
And you should really look for a different host, Geocities sucks with the amount of advertising you have to have... There are alot of free hosts out there, or ones that charge very little and have little to no advertising. Like mine, I usually charge $15 a year... |
Bipolar (III) Inmate From: midair |
posted 03-28-2005 04:46
For a header ( in a large div) I always used the |
Maniac (V) Inmate From: under the bed |
posted 03-28-2005 06:38
text-align only works for text. |
Bipolar (III) Inmate From: Cold Sweden |
posted 03-28-2005 10:58
quote:
|
Bipolar (III) Inmate From: midair |
posted 03-28-2005 19:51
Yes.. |
Maniac (V) Inmate From: under the bed |
posted 03-28-2005 20:09
quote:
quote:
quote:
quote:
|
Bipolar (III) Inmate From: midair |
posted 03-28-2005 20:42
All right! That explains it...The command works on "li" because it is an inline element...and the block level has to be centered differently...ahhh sooo--> |