html - image positioning / div height with display flex -
i positioning of 2 box class div's justify-content: flex-end i'd center top img-container div vertically in remaining space above i'm not sure if possible, preferably without javascript.
the layout portrait orientation mobile devices. maybe justifying content isn't best approach i'd layout places form elements towards bottom of screen , spaces them responds smaller devices taking space logo area.
.flexcontainer { display: -webkit-flex; display: flex; -webkit-flex-direction: column; flex-direction: column; -webkit-align-items: center; align-items: center; -webkit-justify-content: flex-end; justify-content: flex-end; /*iphone 4*/ height: 480px; width:320px; /*iphone 6*/ /*height: 667px; width:375px;*/ background-color: blue; border: 1px solid red; } .box { text-align:center; height: auto; width: 100%; background-color: green; border: 1px solid pink; margin: 3px; padding-top:20px; padding-bottom:20px; margin-top:20px; margin-bottom:20px; } .img-container{ text-align:center; }
<div class="flexcontainer"> <div class="img-container"> <img src='https://wiki.maemo.org/images/thumb/d/de/maemo.org_logo_contest_sample1_bundyo.png/300px-maemo.org_logo_contest_sample1_bundyo.png' width='80%'/> </div> <div class="box"> <input type="text" placeholder="username"> <br> <input type="password" placeholder="password"> <br> <button>submit</button> </div> <div class="box"> <button>password reset</button> <br> <button>register</button> </div> </div>
you change little bit of code , achieve want.
fiddle: https://jsfiddle.net/gczcorn0/
i modified image container this:
<div class="box clear img-container"> <img src='https://wiki.maemo.org/images/thumb/d/de/maemo.org_logo_contest_sample1_bundyo.png/300px-maemo.org_logo_contest_sample1_bundyo.png' width='80%'/> </div>
so takes same properties boxes below. assume don't want background-color
, border
on image box clear css attributes this:
.box.clear { background-color: transparent; border: none; }
i'm not sure meant how want behave in smaller devices since width set 320px in example.
edit based on comment:
this updated fiddle shows can in situation expressed in comments: https://jsfiddle.net/gczcorn0/2/
Comments
Post a Comment