html - Div still has height:0px -
i have div has content still has height:0px;
, in example can see "index-slideshow" has height:0px;
, need "position:absolute;" because photos must 1 above other jquery slideshow.
this div has contents hasn't height. what's problem?
#index-slideshow { margin: 0px; position: relative; width: 100%; padding: 0px; max-width: 100%; box-sizing: border-box; z-index: -1; } #index-slideshow > img { position: absolute; top: 0px; left: 0px; width: 100%; max-width: 100%; margin: auto; box-sizing: border-box; } .wrap { margin: 0 auto; width: 950px; max-width: 93%; border: 0px; padding: 0px 10px 10px 10px; background-color: blue; color: white; }
<div id="index-slideshow"> <img src="http://lorempixel.com/400/200"> <img src="http://lorempixel.com/g/400/200"> </div> <div class="wrap"> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. pellentesque suscipit magna ... </p> </div>
it because, 2 images inside <div>
has position: absolute;
. absolutely positioned elements not take space.
see example here:
.border {border: 1px solid #999; margin-bottom: 100px;} .abs {position: absolute; height: 50px; width: 50px; background-color: #ccc;}
<div class="border"> <div class="abs">i absolute!</div> </div> <div class="border"> hi <div class="abs">i absolute!</div> </div>
it impossible calculate height of absolutely positioned elements, css, because not in layout.
either make position
of images static
or give min-height
.
Comments
Post a Comment