html - Align div top to the bottom of a sibling div -


i want place dropdowncontainer below inputcontainer, without dropdowncontainer being encased within autocompletecontainer.

when scrolled, dropdowncontainer should move inputcontainer. same when token divs removed or added.

if remove position:absolute dropdowncontainer aligns correctly, appears inside autocompletecontainer

i prefer without js/jquery, i'll use if there no other option.

here's codepen link: http://codepen.io/rishadjb/pen/lrxzpn

thank you.

.maincontainer{    width:700px;      position: relative;  }  .autocompletecontainer{    background: none repeat scroll 0 0 #ececec;      float: left;      width: 100%;  /*   height:60px; */      max-height: 100px;      z-index: 1;      padding: 4px 0;      display: flex;      flex-wrap: wrap;      cursor: text;      text-align: left;      background-color: #e4e4e4;      overflow-y: auto;      overflow-x: hidden;  }    .token{        background-color: #f7982f;      border-radius: 10px;      color: #fff;      display: flex;      font-family: sans-serif;      font-size: 13px;      font-weight: 400;      margin: 2px;      padding: 2px 5px;  }    .inputcontainer{        flex-grow: 1;    position:relative;  }    .autocompleteinput{        border: medium none;      outline: none;      width: 100%;      padding: 2px 12px;      background: transparent;      color: #008cc1;    }    .dropdowncontainer{    height:60px;    width:100%;    position:absolute;    background:red;    z-index:999;    border:1px solid blue;  }
<div class="maincontainer">    <div class="autocompletecontainer">      <div class="token">tokentoken</div>      <div class="token">tokentokentokentoken</div>      <div class="token">tokentoken</div>      <div class="token">tokentokentokentoken</div>      <div class="token">tokentoken</div>      <div class="token">tokentokentokentoken</div>      <div class="token">tokentoken</div>      <div class="token">tokentokentokentoken</div>      <div class="token">tokentoken</div>      <div class="token">tokentokentokentoken</div>      <div class="token">tokentoken</div>      <div class="token">tokentokentokentoken</div>      <div class="token">tokentoken</div>      <div class="token">tokentokentokentoken</div>      <div class="token">tokentoken</div>      <div class="token">tokentokentokentoken</div>      <div class="token">tokentoken</div>      <div class="token">tokentokentokentoken</div>      <div class="token">tokentoken</div>      <div class="token">tokentokentokentoken</div>            <div class="inputcontainer">        <input class="autocompleteinput" value='inputtext'/>      </div>            <div class="dropdowncontainer">dropdown container</div>            </div>  </div>

does .autocompletecontainer has float? if remove declaration, need add dropdowncontainer:

.dropdowncontainer{     left: 0;     top: 100%; } 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -