Background colors in floated elements only respect the height of any
child elements that are also themselves floated. This is the “float to
clear floats” rule espoused by Dan Cedarholm in his book Bulletproof
Web Design. But remember that floated elements shrink-wrap around
their contents so if you set a background color on one of the
innermost DIVs, that background color will only appear to be as tall
as the contents of the DIV, not the DIV itself or its parent.
There are a few ways to create the color columns within inline DIV
elements such as the layout you describe. One of the easiest is to
make a tiling background image about 25 px tall and as wide as your
centered element, with as many stripes of color as you have columns.
(ASCII-gram of a two-column background image follows)
[///////////////////////////////////|%%%%%%%%%%%]
Apply this image to your centered inline DIV, set to tile vertically.
Now as long as your inner DIVs are the correct widths to match this
image, the illusion will be complete. No matter how tall the
individual inline columns are in reality, they will each appear to
have a background color that matches the height of the tallest column.
Walter
On Mar 27, 2010, at 12:32 PM, Chris Klein wrote:
Hi,
First-time poster here. I’m building a box model site according to
Dan’s videos. Here’s what I’m experiencing.
I have an outer box with 5 full width “sections”. In each of those
sections, I have a less-wide, full height box for the centering
effect described in the videos.
Applying color fills works just fine UNTIL I add two floated column
boxes to my main, centered content area. Then, the color fills of
the container holding the two floated column boxes won’t display in
a browser. I can fill the columns with color and they display in the
browser, but not their container.
Is there a limit to how many levels of containers there can be?
Thanks for any help you can give.
Chris
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options