Member Avatar for Member #891530

I'm having a hard time finding the right configuration for my css layout. Maybe I'm trying too many things at once.

What I want is to have a center column be 988px wide, and the left and right columns to evenly take up the rest of the browsers width. In addition, I want a footer to remain on the bottom even if there is no content in the center div. I can accomplish this part fine - so far.

The right and left divs will contain a background image and repeat-x - BUT, the issue is I'm trying to create the illusion the background image (for all 3 divs) is a solid image spanning the whole width of the browser - http://www.daniweb.com/forums/thread345979.html is the link to my original post on this topic, but the replies don't quite get me there.

If you notice from the above link - for the left div - its background image (right edge) must align with the left edge of the center div -- for the right div - its background image (left edge) must align with the right edge of the center div (confusing if you don't look at the graphic examples I made from the above link).

The whole reason I'm having to do this crazy mess is because I have some nav buttons in which I want a glow effect (done in photoshop using a layer blend) to happen on rollover, and the only way I know how to accomplish that is to include part of the background in each button state - I can't just make a transparent button because the glow is based upon its background.

From all the experimenting I've done, I have messed with the (min-height:100%; height:auto !important; height:100%) combination, but I can't figure out which div(s) need this. The left and right divs only contain a background image. I want their height to expand the same as the center div (according to how much content I stick into the center div).

Lastly, I want a footer (width:100%; height:150px) to stick on the bottom. I've read at least 30 web pages about sticky footers and similar to what I'm trying to accomplish, but I haven't found anything specific to what I want (it can't be that uncommon). I'm pretty sure it's all just a matter of having the right combination of css properties under the proper divs, but I just can't figure it out.

If it weren't for the left and right divs needing to be the way I described above, I've figured everything else out - the ultimate goal is to incorporate the left and right div with their background images.

If anyone can shed some light, I would buy you a cookie or two... thanks..

Dani AI

Generated

As hinted, you can force-equal heights with script, but a cleaner, CSS-only approach avoids reflows and makes the footer reliably “sticky.” Put the repeating artwork on a single full-width layer (body or a top-level wrapper) so the left/center/right visually line up, then use Flexbox to make the side columns share remaining width and stretch to the center column’s height. The footer stays at the bottom by making the page a column-flex container and letting the content area grow.

HTML/CSS (minimal example)

<div class="page">
  <div class="wrap">
    <div class="col left"></div>
    <div class="col center">...your content...</div>
    <div class="col right"></div>
  </div>
  <footer class="site-footer">Footer</footer>
</div>

html, body { height:100%; margin:0; }
body { background: url('bg-repeat.png') repeat-x top left; } /* single repeating artwork */
.page { min-height:100vh; display:flex; flex-direction:column; }
.wrap { display:flex; flex:1; align-items:stretch; }
.col.left, .col.right { flex:1 1 0; min-width:0; } /* share remaining width */
.col.center { flex:0 0 988px; width:988px; box-sizing:border-box; }
.site-footer { height:150px; }

Notes and troubleshooting

  • With the repeating image on the body the center column should be transparent so the pattern appears continuous. If you must keep separate side-slice images, place them on .col.left and .col.right and anchor them with background-position: right top (left slice) and background-position: left top (right slice) so edges align with the center column.
  • For nav buttons that rely on background for a glow: use transparent PNGs or SVGs so they sample the page background, or recreate the glow with CSS (box-shadow / filter: drop-shadow) to avoid slicing every button state.
  • Flexbox handles dynamic height changes (images, long content) without JS. If you need very old-browser support (IE8), use a JS fallback or a table/display-based layout as a progressive enhancement.

This keeps the layout responsive, avoids height-sync scripts, and preserves a seamless repeating background across left/center/right while keeping a fixed-height footer at the bottom.

Hi.
As I understand you want the left and right divs be the same height as the center div, right? And the left and right divs have the same height (static). Only the center div changes its height.
I can suggest you using jquery methode.
First of all be sure that you include the latest version of jquery library in your html. I attach one, you can use it. The use this script:

<script type="text/javascript">
$(function(){
var rightLeft= $('#right').height();
var center=$('#center').height();
if(rightLeft<center){
$('#right').height($('#center').height());
$('#left').height($('#center').height());}
else{$('#center').height($('#right').height());}

});
</script>

And also for the footer being in the right place do the following in your css.

#footer{
clear:both;}//to clear all the floats;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.