CSS HTML overflow issue with static header in wrap -
i struggling bottom part of overflowing content can seen in fiddle. how go fixing this, while keeping layout?
http://jsfiddle.net/sa6cb/392/
css:
.wrapper { overflow-y: hidden; overflow-x: hidden; border: 1px solid #000; height: 200px; width: 200px; } .wrappedheader { position: static; border-bottom: 1px solid #000; padding: 15px; } .wrappedbody { position: relative; overflow-y: auto; height: 100%; padding: 15px; }
html:
<div class="wrapper"> <div class="wrappedheader"> header </div> <div class="wrappedbody"> <!-- content causing overflow-y --> </div> </div>
your wrappedbody has height 100%, 100% of parent, wrapper. however, wrapper has 2 children, wrappedbody and wrappedheader. height of wrappedbody should height of wrapper minus height of wrappedheader:
.wrappedbody { position: relative; overflow-y: auto; height: calc(100% - 79px); /* 79 = wrappedheader height + wrappedbody padding*/ padding: 15px; }
Comments
Post a Comment