Prev | Current Page 207 | Next

Tommy Olsson and Paul O'Brien

"The Ultimate CSS Reference"


The containing block is the reference rectangle whose position and dimensions are
used for relative calculations of descendant elements??™ positions and dimensions.
Although elements are positioned with respect to their containing block, they??™re
not confined by it, and they may overflow. In most cases, generated boxes act as
containing blocks for descendant boxes. The full details of containing blocks are
covered in Containing Block (p. 147).
For floated (p. 180) or absolutely positioned (p. 178) elements (including elements
for which position is set to fixed (p. 178)), a width of auto will make the generated
box shrink to the intrinsic dimensions of its contents.
Floated Elements and Width
Previously, in CSS2, floated elements without a declared width value would not
shrink to wrap their content; instead, they??™d expand to the full width of their parent
element. This behavior was changed in CSS2.1 to allow the shrink-wrapping to take
place. However, in Internet Explorer 6 and earlier versions, a floated element with
no declared width value will shrink to wrap its content as per the specifications
unless a child element has a layout (p.


Pages:
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219