image positioning / div height with display flex

Mobile Technologies Mobile Computing 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating
_x000D_ _x000D_ I like the positioning of the two box class div's with justify-content: flex-end but I'd like to center the top img-container div vertically in the remaining space above but I'm not sure if this is possible, preferably without javascript. The layout is for portrait orientation mobile devices. Maybe justifying the content isn't the best approach but I'd like a layout that places the form elements towards the bottom of the screen and spaces them well but responds to smaller devices by taking space from the logo area. _x000D_ _x000D_ .flexcontainer {_x000D_ display: -webkit-flex;_x000D_ display: flex;_x000D_ -webkit-flex-direction: column;_x000D_ flex-direction: column; _x000D_ -webkit-align-items: center;_x000D_ align-items: center;_x000D_ -webkit-justify-content: flex-end;_x000D_ justify-content: flex-end;_x000D_ _x000D_ /*iPhone 4*/_x000D_ height: 480px;_x000D_ width:320px;_x000D_ /*iPhone 6*/_x000D_ /*height: 667px;_x000D_ width:375px;*/_x000D_ _x000D_ background-color: blue;_x000D_ border: 1px solid red;_x000D_ }_x000D_ _x000D_ .box {_x000D_ text-align:center;_x000D_ height: auto;_x000D_ width: 100%;_x000D_ background-color: green;_x000D_ border: 1px solid pink;_x000D_ margin: 3px;_x000D_ padding-top:20px;_x000D_ padding-bottom:20px;_x000D_ margin-top:20px;_x000D_ margin-bottom:20px;_x000D_ }_x000D_ _x000D_ .img-container{_x000D_ text-align:center;_x000D_ }_x000D_
_x000D_
_x000D_ _x000D_
_x000D_ _x000D_
_x000D_ _x000D_
_x000D_ _x000D_
_x000D_ _x000D_
_x000D_
_x000D_ _x000D_
_x000D_ _x000D_
_x000D_ _x000D_
_x000D_ _x000D_

Posted on 16 Aug 2022, this text provides information on Mobile Computing related to Mobile Technologies. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago
_x000D_ You could change just a little bit of code and achieve what you want. Fiddle: https://jsfiddle.net/gczcorn0/ I just modified your image container to be like this:
So this takes the same properties as the boxes below. Then I assume you don't want the background-color and border on the image box so just clear the css attributes like this: .box.clear { background-color: transparent; border: none; } I'm not sure what you meant by how you want it to behave in smaller devices since the width is set to 320px in the example. EDIT based on comment: This updated fiddle shows what you can do in a situation that you expressed in the comments: https://jsfiddle.net/gczcorn0/2/

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

Important Mobile Technologies Links