Search code examples
htmlcsspositioningliquid-layout

CSS one div with liquid width next to a floating div that may or may not exist


I have already read this question but I can't get my head to work a solution that fits my needs, because my situation is a bit different and because I am not very good at CSS.

What I have is a div containing three other divs:

  • div1 on the left
  • div2 centered
  • div3 on the right

The problem is that div2 may or may not exist.

This is what I currently have:

enter image description here

But this is what I want:

enter image description here

Here is my Fiddle

Any ideas? Thanks!


Solution

  • #div3{
    display:block;
    background: #CCC;
    overflow: hidden;
    }
    

    http://jsfiddle.net/5xgwz/17/