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

Home Forums CSS Automatically adjust DIV width

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #28638


    I’ve a DIV with fixed width, this DIV contains 2 sub divs. Say it is, col_one and col_two. Col_one has the content whereas, col_two is for some kind of links/tips. In some of the web pages of website, there will be no col_two, means that page doesn’t contain any Tips / Links tod isplay so the col_two (that will be the right panel) will be blank.

    What I want, when there will be no data in the col_two, the col_one width’s expand and cover that area. So it’ld not show the empty space. And if there is some content in the col_two (right panel), then the col_one (left panel) shrinks to fit that.

    Any help will be highly appreciated.


    You can make col_two width: 50% and have no width set for col_one. That way, when there is content for both, it fits nicely, and when you don’t have a col_two, the col_one div will still stretch all the way across.

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