html - Flexed div shrinks beyond content size -
fiddle: check here
a normal card looks this:
however, when browser display resized, shrinks this:
the html:
#product-list { overflow-y : scroll !important; height: 100%; }
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet"/> <body class="bg-faded h-100"> <!--this insert tabs--> <div id="current-tab" style="" class="h-100 fixed-top"> <div class="container-fluid d-flex flex-row m-0 p-0 h-100 w-100"> <div id="products" class="bg-white d-flex flex-column"> <!--product list--> <div id="product-list" class="card-deck p-4 bg-light"> <!--product card--> <div class="card mb-3"> <img class="card-img-top" src="https://cbp.s3.amazonaws.com/img/0/0/4/8/4/5/tn050016-the-national-trouble-will-find-me-2x12-vinyl-g-3.png" alt="card image cap"> <div class="card-body"> <h4 class="card-title">card title</h4> <p class="card-text">some quick example text build on card title , make bulk of card's content.</p> </div> <ul class="list-group list-group-flush"> <li class="list-group-item "><b class="pl-0 pr-5">price</b>₱200.00</li> <li class="list-group-item"><b class="pl-0 pr-3">quantity</b> 19</li> </ul> <div class="card-footer d-flex border-top-0 pl-4 pr-4"> <a href="#" id="edit-product-button" class="btn btn-outline-primary ml-auto w-50 mr-3">modify</a> <a href="#" id="delete-product-button" class="btn btn-outline-danger mr-auto w-50">delete</a> </div> </div> </div> </div> </div>
the entire application on position: fixed
, #product-list
should scrollable added this:
#product-list { overflow-y : scroll !important; height: 100%; }
i using boostrap 4.0.0 beta, running on chrome.
both #product-list
, .card
have display: flex;
property. since .card
direct child of #product-list
, has display: flex
property fill space allocated—but no more. technically .card
@ 100% height.
to fix need following:
- remove
.card-deck
#product-list
. - wrap
.card
divs.card-deck
. - change
.card
'sheight
propertyheight: 100%;
min-height: 100%;
.
in jsfiddle example, i've made these changes , .card
works desired.
Comments
Post a Comment