Re: div/bg color issue.. ok, here's the deal....;)
- From: Ben C <spamspam@xxxxxxxxx>
- Date: Thu, 18 Jun 2009 16:51:43 -0500
On 2009-06-18, maya <maya778899@xxxxxxxxx> wrote:
Ben C wrote:[...]
Well I would have your best shot at it and be prepared to discuss with
them the relative merits of some of the techniques you've seen, like:
1. Background images with repeat-y pretending to be column backgrounds.
2. Borders pretending to be column backgrounds.
3. Absolute positioning and z-index.
4. display: table-cell.
5. dorayme-style nesting (but you need to be able to rank the columns in
order of height)
I did at one point yesterday try "cascading" the divs on top of each
other with z-Index:0.. (giving the first div a margin-right of about
600px or whatever, then putting the 2nd "on top" with a margin-left and
z-Index:1, etc.. but that didn't work out too well.. (and bg-colors
still wouldn't fill entire div..)
(what is "dorayme-style"??)
It's the thing Jeff mentioned. IIRC it works something like this:
<div style="overflow: hidden" id="container">
<div style="float: left; width: 250px">
Left column contents. Left column has to be the one with more
stuff in it, so it's the higher of the two columns. Of
course you could use a right float etc. if the longer column
was on the right. Point is, the longer column is the float,
the shorter one normal-flow.
</div>
<div style="margin-left: 250px">
Right column contents. Shorter.
</div>
</div>
You set the left column's background on the float, and the right
column's background on the container, leaving the right column div
background: transparent (default anyway).
Because the container is overflow: hidden, it grows to the height of the
float (which we require to be the taller of the two columns).
For three columns, just nest again (old saw: there is no problem that
cannot be solved with another level of nesting).
Overflow: hidden to contain floats doesn't work in IE so either you use
some obscure proprietary crap like "zoom: 1", or, more pragmatically,
just insert <div style="clear:both"></div> after the two columns and
don't use overflow: hidden.
.
- Follow-Ups:
- Re: div/bg color issue.. ok, here's the deal....;)
- From: dorayme
- Re: div/bg color issue.. ok, here's the deal....;)
- References:
- div/bg color issue..
- From: maya
- Re: div/bg color issue..
- From: John Hosking
- Re: div/bg color issue..
- From: Ben C
- Re: div/bg color issue..
- From: John Hosking
- Re: div/bg color issue..
- From: maya
- Re: div/bg color issue..
- From: Nik Coughlin
- Re: div/bg color issue..
- From: Jeff
- Re: div/bg color issue.. ok, here's the deal....;)
- From: maya
- Re: div/bg color issue.. ok, here's the deal....;)
- From: Ben C
- Re: div/bg color issue.. ok, here's the deal....;)
- From: maya
- div/bg color issue..
- Prev by Date: Re: div/bg color issue.. ok, here's the deal....;)
- Next by Date: Re: div/bg color issue.. ok, here's the deal....;)
- Previous by thread: Re: div/bg color issue.. ok, here's the deal....;)
- Next by thread: Re: div/bg color issue.. ok, here's the deal....;)
- Index(es):
Relevant Pages
|