- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Flex container width when flex-flow is set to column wrap in HTML
If you have a container with flex height & display flex, then follow this if you want the children to be laid in the column.
Make changes in settings:
-webkit-flex-flow: column wrap;
And for this Chrome automatically add space between div and border top. If we do not want to add space automatically, then we can use:
margin-bottom:100%;
This will move the item up
.flex-container { position: fixed; height: 80%;//this will change height of flex container to 80% padding: 1; margin: 1; // this will change margin to 1 list-style: none; border: 7px solid red; // this will change border to solid red display: -webkit-box; display: -moz-box; display: -ms-flexbox; display: -webkit-flex; display: flex; -webkit-flex-flow: column wrap; justify-content: flex-start align-content: flex-start; align-items: flex-start } /** Just to show the elements */ body { margin: 0; padding: 0; } .flex-item { background: tomato; padding: 5px; width: 100px; height: 100px; margin-bottom: 100%; line-height: 150px; color: white; font-weight: bold; font-size: 3em; text-align: center; } <ul class="flex-container"> <li class="flex-item">1</li> <li class="flex-item">2</li> <li class="flex-item">3</li> <li class="flex-item">4</li> <li class="flex-item">5</li> <li class="flex-item">6</li> </ul>
- Related Articles
- CSS flex-wrap Property
- Wrap flex items in Bootstrap
- Shorthand CSS property for flex-direction and flex-wrap
- CSS flex container properties
- Bootstrap 4 .flex-wrap class
- CSS flex-flow Property
- Role of CSS flex-wrap property wrap value
- Set Flex Items into equal width columns with Bootstrap
- Bootstrap 4 .flex-wrap-reverse class
- Bootstrap 4 .flex-*-wrap class implementation
- Wrap the flex items with CSS
- Role of CSS flex-wrap property wrap-reverse value
- Role of CSS flex-wrap property no-wrap value
- Wrap flex items in reversed order in Bootstrap
- How to adopt a flex div's width to content in HTML?

Advertisements