html - Aligning Web Forms -
i have 2 forms want align. able figure out how align height, can't width work way want.
in situation, want left box fill in remaining space. using 'auto' fills in space fit contents. instead of expanding form, there gap between 2 forms.
the reason require have php around form. there flag dictates whether or not second form shows up. if there 1 form, want expand entire space. if there 2 forms, want them share space.
the way thought of doing set right form specific width , have left form mold whether or not else exists. can't figure out how left form expand without specifying exact width.
i've included html , css below jsfiddle reference.
html
<div class="section"> <div class="container"> <form> <fieldset class="left"> <legend>pc management</legend> <div> <input type='submit' value='backup' /> <input type='submit' value='backup' /> <input type='submit' value='backup' /> </div> </fieldset> </form> <form> <fieldset class="right"> <legend>pc management</legend> <div> </div> </fieldset> </form> </div> </div>
css
.section { margin: 0 auto; text-align: center } .container { height: 100px; width: 500px; } .container form, .container fieldset, .container input { height: 100%; display: inline; } .left { width: auto; float: left; } .right { width: 40%; float: right; }
display: flex
dynamic resizing want without needing javascript:
.section { margin: 0 auto; text-align: center } .container { height: 100px; width: 500px; display: flex; } .container form { flex: 1 1 auto; } .container form, .container fieldset, .container input { height: 100%; }
<div class="section"> <div class="container"> <form class="left"> <fieldset> <legend>pc management</legend> <div> <input type='submit' value='backup' /> <input type='submit' value='backup' /> <input type='submit' value='backup' /> </div> </fieldset> </form> <form class="right"> <fieldset> <legend>pc management</legend> <div> </div> </fieldset> </form> </div> </div>
Comments
Post a Comment