Note that there are some explanatory texts on larger screens.

plurals
  1. POLayout with 2 variable-height columns
    primarykey
    data
    text
    <p>I'm trying to create the following 2-column layout in my webpage:</p> <pre><code>+-------+---+ | | | | | | | A | B | | | | | | | | | | | +---+ | | | | | C | | | | +-------+---+ </code></pre> <p>With the following characteristics:</p> <ol> <li>Both the left and the right columns have a fixed width.</li> <li>The content of C is fixed, so C has a fixed height.</li> <li>The amount of content in A and B can vary (the end user provides this), and therefore the required minimum height for A and B can vary.</li> <li>If A requires more height than B and C combined, then B's height should be stretched so that it keeps touching C, and C's bottom aligns with A's bottom.</li> <li>If A requires less height than B and C combined, then A should be stretched so that the bottom of A and C align.</li> <li>A and B have a distinct border and/or background color, so I can't cheat by not stretching one of them (and C doesn't need stretching).</li> </ol> <p>I tried doing this by representing each cell with a div and using jQuery's document ready event to adjust the cells to the appropriate heights, depending on which column is the tallest.<br> Most of the time, this works. However, because A contains an embedded YouTube video, and C contains an embedded Google Maps section, there is a lot of dynamic content adjusting going on, and this sometimes causes my javascript code to work with the wrong height values and mess up the layout process.<br> Also, it looks rather ugly when you see the content cells being stretched to their correct height, even though I could live with this if it worked consistently.</p> <p>As an alternative, I tried using a table for this layout, since they have the "keep all columns equally high" behaviour built-in.<br> The problem with this approach is that I have to use "td rowspan=2" for A, and once I do, IE and Chrome ignore any fixed height that I specify on C but instead makes C way too high.</p> <p>So basically I'm completely stuck on how to implement this (seemingly simple) layout. Can anyone point me in the right direction?</p> <p>I'm targetting Chrome, FireFox and IE7+, but in IE7 and IE8 a reasonable approximation of the desired layout is acceptable.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload