html - Aligning divs underneath each other -


i have html:

<div id="container" class="container">      <div id="menu-top">         <div class="top-menu">              <div class="top-menu-buttons">                 <button class="button button-icon ion-minus-circled"></button>                 <span>{{amount}}</span>                 <button class="button button-icon ion-plus-circled"></button>             </div>         </div>     </div>      <div id="classic" class="classic">         <div id="classic-img" class="classic-img">             <img ng-src="{{image.filtered}}" />         </div>     </div>      <div id="menu-bottom">         <div class="bottom-menu">             <div class="bottom-menu-buttons">                 <button class="button button-icon ion-eye"></button>                 <button class="button button-icon ion-refresh"></button>                 <button class="button button-icon ion-crop"></button>                 <button class="button button-icon ion-android-options"></button>                 <button class="button button-icon ion-social-tumblr"></button>             </div>         </div>     </div>  </div> 

and css:

.container {     width: 100%; }  .classic {     display: block;     position: relative;     margin-left: auto;     margin-right: auto;     background-position: center center;     background-image: url("../img/frames/postcard_00.png");     background-size: contain;     background-repeat: no-repeat; }  .classic-img {     display: block;     position: absolute;     overflow: hidden;     width: 100%;     height: 100%;     top: 6%;     left: 5%; }  .classic img {     position: absolute;     width: 100%;     height: 100%;     top: 0;     left: 0; }  .top-menu {     position: relative;     width: 100%;     height: 50px;     background-color: red; }  .top-menu-buttons {     position: absolute;     margin-left: auto;     margin-right: auto;     bottom: 0;     left: 0;     right: 0;     width: 50%;     text-align: center; }  .top-menu-buttons .button {     display: inline-block;     vertical-align: middle;     font-size: 25px;     color: white; }  .top-menu-buttons span {     display: inline-block;     vertical-align: middle;     font-size: 25px;     color: white; }  .bottom-menu {     position: relative;     width: 100%;     height: 50px;     background-color: green; }  .bottom-menu-buttons {     position: absolute;     margin-left: auto;     margin-right: auto;     bottom: 0;     left: 0;     right: 0;     width: 80%;     text-align: center; }  .bottom-menu-buttons .button {     display: inline-block;     vertical-align: middle;     font-size: 35px;     color: white;     padding-left: 10px;     padding-right: 10px; } 

the result want have:

enter image description here

the result got above code:

enter image description here

my css designed blue content under red (top menu) , green (bottom menu) under blue content. cant find mistake made.

see fiddle

position:absolute culprit.

you have remove .classic-img , .classic-img img. also, remove height: 100%; .classic-img img. changed css below

.classic-img {     display: block;     /* position: absolute; */     overflow: hidden;     width: 100%;     height: 100%;     top: 6%;     left: 5%; }  .classic-img img {     /* position: absolute; */     width: 100%;     /* height: 100%; */     top: 0;     left: 0; } 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -