jquery - Position div inside another div without absolute -
i've seen few questions around, no answers worked me far. i'm trying inside div on bottom of outer div (although not entirely, want, like, 5px margin bottom), can't seem position @ without putting position on absolute. if that, though, width , centering doesn't work anymore.
is there way me achieve that?
here's code:
var height = $('.windows').height()*0.85; $('.windows-content').css('height', height);
.windows { max-width: 900px; width: 70%; min-height: 300px; height: auto; box-shadow: -1px -1px 0px 0px #000 inset, 1px 1px 0px 0px #fff inset, -2px -2px 0px 0px #868a8e inset; background-color: #c2c5ca; margin: 0 auto; } .windows-content { width: 98.5%; height: auto; box-shadow: 2px 2px 0px 0px #000 inset, -1px -1px 0px 0px #fff inset; background-color: #fff; margin: auto; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script> <div class="windows" id="home-window"> <div class="windows-content"></div> </div>
you use flex box result looking
see code snippet:
var height = $('.windows').height() * 0.85; $('.windows-content').css('height', height);
.windows { max-width: 900px; width: 70%; min-height: 300px; background-color: #c2c5ca; margin: 0 auto; display: flex; align-items: flex-end; justify-content: center; padding-bottom:5px; } .windows-content { width: 98.5%; background-color: red; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script> <div class="windows" id="home-window"> <div class="windows-content"></div> </div>
Comments
Post a Comment