You need to have margin-left and margin-right to be auto something like this:


#container {
        width: 960px;
        background-color: silver;
}
#contained {
        width: 500px;
        margin: 0 auto;
        background-color: gray;
}

Your HTML might look like this:

<div id="container">
        <div id="contained">Contained</div>
</div>

If this doesn't help then please post a link to your page for us to have a look 
at the source code.

Good luck.


> I have the below link to a problem. I have an absolute page
> and container
> width, but I have a div inside the container that I need
> centered no matter
> how wide that contained div is. How can I make the contained
> div only as
> wide as its content and center it?
> 
> http://mindarc.com/capture.JPG
> 

______________________________________________________________________
css-discuss [css-d@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to