html - How is div's height growing as i'm adding elements to it -


can tell me making div's height increase i'm adding more , more text.i'm new css , got div site don't want height grow add more , more text.sorry asking such lame question i'm new , don't understand concepts well

here fiddle link: https://fiddle.jshell.net/nud13xnu/ css:

.full-width1{ width:37%;margin-top:30px;margin-left:10%;min- height:0px;position:relative;max-height:50px;z-index:0;; } .form-style-fake{position:absolute;top:0px;} .form-style-base{position:absolute;top:0px;z-index:0;;opacity: 0;} .form-control1{padding: 10px 50px;} .form-input1{height:50px;border-radius: 0px;margin-top: 20px;}  .truncate {  width: 250px;  white-space: nowrap;  overflow: hidden;  text-overflow: ellipsis;  } .bg-form1{ float:left;width:100%; position:relative; background: url("http://lorempixel.com/200/200/abstract/"); background-repeat: no-repeat; background-size: cover; margin-top: 0px; } .bg-transparent{  background: rgba(0,0,0,0.5);float: left;  width: 100%;margin-top: 0px; } .container1{  background: url("http://lorempixel.com/800/800/nature/");  background-repeat: no-repeat;  background-size: cover;  z-index: 0; } custom-form1{float: left;width:100%;border-radius: 20px;box-shadow: 0 0 16px #fff;overflow: hidden;   margin-top: 30%;   background: rgba(255,255,255,0.6);  } .img-section1{  float: left;width: 100%;padding-top: 15px;padding-bottom: 15px;background:   rgba(0,0,0,0.7);position: relative;  } .img-section1 h4{color:#fff;}   .color{   color:#fff;  }    .form-control1::-webkit-input-placeholder {    color:lightgray;    font-size:18px;    }   .form-control1:-moz-placeholder {     color:lightgray;     font-size:18px;    }   .form-control1::-moz-placeholder {     color:lightgray;     font-size:18px;    }   .form-control1:-ms-input-placeholder {     color:lightgray;     font-size:18px;   } 

please help.

the div wraps list doesn't have specified height, grow accommodate content. if want limit height, give height or max-height value. combined overflow-y: scroll, have, make scroll if content height exceeds parent's specified height.

here i've added max-height: 300px in inline styles limit it's growth 300px.

.full-width1 {    width: 37%;    margin-top: 30px;    margin-left: 10%;    min-height: 0px;    position: relative;    max-height: 50px;    z-index: 0;    ;  }    .form-style-fake {    position: absolute;    top: 0px;  }    .form-style-base {    position: absolute;    top: 0px;    z-index: 0;    ;    opacity: 0;  }    .form-control1 {    padding: 10px 50px;  }    .form-input1 {    height: 50px;    border-radius: 0px;    margin-top: 20px;  }    .truncate {    width: 250px;    white-space: nowrap;    overflow: hidden;    text-overflow: ellipsis;  }    .bg-form1 {    float: left;    width: 100%;    position: relative;    background: url("http://lorempixel.com/200/200/abstract/");    background-repeat: no-repeat;    background-size: cover;    margin-top: 0px;  }    .bg-transparent {    background: rgba(0, 0, 0, 0.5);    float: left;    width: 100%;    margin-top: 0px;  }    .container1 {    background: url("http://lorempixel.com/800/800/nature/");    background-repeat: no-repeat;    background-size: cover;    z-index: 0;  }    .custom-form1 {    float: left;    width: 100%;    border-radius: 20px;    box-shadow: 0 0 16px #fff;    overflow: hidden;    margin-top: 30%;    background: rgba(255, 255, 255, 0.6);  }    .img-section1 {    float: left;    width: 100%;    padding-top: 15px;    padding-bottom: 15px;    background: rgba(0, 0, 0, 0.7);    position: relative;  }    .img-section1 h4 {    color: #fff;  }    .color {    color: #fff;  }      /*====== style placeholder ========*/    .form-control1::-webkit-input-placeholder {    color: lightgray;    font-size: 18px;  }    .form-control1:-moz-placeholder {    color: lightgray;    font-size: 18px;  }    .form-control1::-moz-placeholder {    color: lightgray;    font-size: 18px;  }    .form-control1:-ms-input-placeholder {    color: lightgray;    font-size: 18px;  }
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"/>  <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>  <div class="full-width1" style="" id="mymodal">    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="z-index:0; ">      <div class="custom-form1" style=" ">        <div class="text-center bg-form1" style="width: 100%">          <div class="img-section1">            <a href="#" class=" glyphicon glyphicon-remove" style=" float: left;margin-left: 5px" onclick="document.getelementbyid('prof4').style.display='none';"></a>            <h2 style=" font-family: 'baskerville';color: white">create dummy profile</h2>          </div>        </div>        <div class="col-lg-12 col-md-12" style="max-height:300px;overflow-y: scroll;">          <a href="#" style="color:black;font-size: 24px;">            <h5 class=" glyphicon glyphicon-star" style="color: gold"></h5> bill gates</a>          <br/>          <a href="#" style="color:black;font-size: 24px;">            <h5 class=" glyphicon glyphicon-star" style="color: gold"></h5> coldplay</a>          <br/>          <a href="#" style="color:black;font-size: 24px;"><h5 class=" glyphicon glyphicon-star" style="color: gold"></h5> adam levine</a>          <br/>          <a href="#" style="color:black;font-size: 24px;"><h5 class=" glyphicon glyphicon-star" style="color: gold"></h5> priyanka chopra</a>          <br/>          <a href="#" style="color:black;font-size: 24px;"><h5 class=" glyphicon glyphicon-star" style="color: gold"></h5> taylor swift</a>          <br/>          <a href="#" style="color:black;font-size: 24px;"><h5 class=" glyphicon glyphicon-star" style="color: gold"></h5> sachin tendulkar</a>          <br />          <a href="#" style="color:black;font-size: 24px;"><h5 class=" glyphicon glyphicon-star" style="color: gold"></h5> barack obama</a>          <br />          <a href="#" style="color:black;font-size: 24px;"><h5 class=" glyphicon glyphicon-star" style="color: gold"></h5> shahrukh khan</a>          <br/>          <a href="#" style="color:black;font-size: 24px;"><h5 class=" glyphicon glyphicon-star" style="color: gold"></h5> barack obama</a>          <br />          <a href="#" style="color:black;font-size: 24px;"><h5 class=" glyphicon glyphicon-star" style="color: gold"></h5> barack obama</a>          <br> <a href="#" style="color:black;font-size: 24px;"><h5 class=" glyphicon glyphicon-star" style="color: gold"></h5> barack obama</a>          <br>        </div>        <div class="text-center bg-form1" style="width: 100%;">          <div class="img-section1">            <button class=" btn btn-default" id='mybtn1' style="">priority</button>            <button class=" btn btn-default" id='mybtn2' style="margin-left:21px;margin-top: 1%">work offline</button>            <button class=" btn btn-default" id='mybtn3' style="margin-top: 1%;margin-left: 21px">share</button>            <button class=" btn btn-default" id='mybtn4' style=";margin-top: 1%;margin-left:21px">leave</button>          </div>        </div>      </div>    </div>  </div>


Comments

Popular posts from this blog

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -