On 7/3/05, Linda H [EMAIL-REMOVED]> wrote:
> I can't figure out why I can't get an image to center (actually it doesn't
> work when I replace the image with text either). I am using a div with a
> class that has an attribute 'margin: auto;'. My understanding is that div
> uses the box model, so I don't understand why margin: auto doesn't work.
> The page is at http://tinyurl.com/7ly2d . The pertinent css is embedded.
> but it also references another stylesheet at http://tinyurl.com/degwy
The div is centered, but it has 100% width, and its content is still
left-aligned: Both of these are the defaults, since you have not
specified width or alignment. Unlike tables, divs do not "shrink wrap"
(except in some circumstances when positioned).
So, either give the div a width less than 100%, or use
text-align:center, or both, depending on what other content you will
be adding to it.
New Plymouth, New Zealand
Orphan Gmail invites free to good homes.
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/