Previous Message
Next Message

center a floated div!?!]

Sent by Terrence Wood on 3 August 2004 07:07


try:

<!-- HTML -->
<div class="withimage">
   <img class="centered" />
</div>

/** CSS **/
div.withimage {
   text-align:center;
}
img.centered {
   width: 100px; /* any value */
   height: 100px;
   background: #000;
}



On 3/8/04 5:22 PM, Wes Carr wrote:

> Unfortunately that won't work for me. The desired width is determined by 
> an image inside of the floated div. The whole point of this technique is 
> so that the layout does not have to be aware of any dimensions. My 
> example just hard codes some dimensions on the "body" div, but it's the 
> outer "content1" div that needs to be properly centered and can not know 
> about the dimensions of it's children.

______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: