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
  • #36369

    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>

    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;
    float: left;
    width: 259px;
    height: 220px;
    background-color: #F6F6F6;
    margin: 0 0 0 18px;

    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?


    Sidebar has to come first in the HTML:


    Thanks for the idea!

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