Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Css float problem, dynamic widths

  • 19-08-2009 04:34PM
    #1
    Closed Accounts Posts: 248 ✭✭


    I have a 'content' div that contains two divs floated side by side. The first one is a fixed width, the second one needs to be able to change dynamically based on the width of the content div. The second one should expand out to the far edge of the content div.

    HTML -
    <div class="content">
      <div clas="left-side">
      </div>
    
      <div class="right-side">
      </div>
    </div>
    

    CSS -
    .content{
      width: 800px;
    }
    
    .left-side{
      float: left;
      width: 100px;
    }
    
    .right-side{
      float: left;
     ??????????
    }
    

    So what values should I put in .right-side to make it take up all available horizontal space? In this case it would be 800px-100px = 700px. But I can't set width to be 700px as I need it to fill the space dynamically cos the content div will sometimes have values other than 800px. Anyone got any ideas?


Comments

Advertisement