Expand div when the content overflows

18,172

use stylesheets and change

 width:25px;

to

 min-width:25px;

AND

 height:400px;

to

 min-height:400px;
Share:
18,172

Related videos on Youtube

Kris van der Mast
Author by

Kris van der Mast

Passionate about .NET MVP ASP.NET since 2007 Microsoft ASP Insider aOS ambassador Microsoft Azure Insider Microsoft Extended Experts Team member speaker / teacher involved in several Belgian user groups. moderator on the ASP.NET forums. organizer of CloudBrew, the Belgian Cloud Conference

Updated on April 25, 2022

Comments

  • Kris van der Mast
    Kris van der Mast about 2 years

    I have div with height="400px" and width="25px".How to expand div when the content overflows?

  • cEz
    cEz almost 14 years
    Perhaps changing "height" and "min-height" may be more suitable?
  • Salil
    Salil almost 14 years
    @cez :- Thanks I edit my answer so that it expands vertically as well as horizontally.
  • Chuck Le Butt
    Chuck Le Butt almost 14 years
    I can't imagine why you'd want it to expand horizontally?
  • Aaron Franke
    Aaron Franke over 4 years
    I have a main tag with min-height set and no height, and has div children, but main is not expanding to contain the children. Instead, the children are just overflowing. The footer is at the top of main's content because main's actual size is tiny.