image positioning / div height with display flex

Mobile Technologies Mobile Computing 2 years ago

0 1 0 0 0

_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.

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/
0 views
0 shares

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.

Similar Forum


Q

Would Firebase be a good choice as a server for the Flutter mobile game I'm creating?

_x000D_ _x000D_ I am building a turn-based Flutter game. Would Firebase be a good choice as a server...
Q

Implement Bottom Navigation activity along with a VerticalViewPager with nested Cardview in Android...

_x000D_ _x000D_ I want to develop an Android App which will have a Bottom Navigation Bar and above i...
Q

(JS) For , determine if the device offers or not to capture a photo from the camera

_x000D_ _x000D_ When uploading a file, I need to give the user the possibility: upload the file fr...

Important Mobile Technologies Links