Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS 2 colums div, if 2nd column is not available first coulms take whole width.

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #36369
    longboy
    Member

    I have 2 columns on a page, I want left section to take full width in case if 2nd column is not available, but if 2nd column is available it should take only remaining portion at left side.

    <div id=”maintext”>some text here of 8 lines in case there is 2nd column available.</div>
    <div id=”contactbox”> Our contact here</div>

    css
    #maintext{
    float: left;
    width: 583px;
    background-color: #f6f6f6;
    font-family: “AvantGarde Bk BT”, Tahoma, Verdana, Arial;
    font-size: 11px;
    color: #373737;
    float: left;
    margin: 0 0 18px 0;
    }
    #contactbox{
    float: left;
    width: 259px;
    height: 220px;
    background-color: #F6F6F6;
    margin: 0 0 0 18px;
    }

    Problem:
    if I do width: auto; it is making it 100%, if I make it display: inline-block its doing same and send right box to next line.

    How can I achieve this?

    #95662
    TheDoc
    Member

    Sidebar has to come first in the HTML: http://jsfiddle.net/kEkku/

    #95669
    longboy
    Member

    Thanks for the idea!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.