CSS Flexbox: Use the flex-wrap Property to Wrap a Row or Column
Use the flex-wrap Property to Wrap a Row or Column
CSS flexbox has a feature to split a flex item into
multiple rows (or columns). By default, a flex container will fit all
flex items together. For example, a row will all be on one line.
However, using the
flex-wrap
property, it tells CSS to wrap items. This means extra items move into a
new row or column. The break point of where the wrapping happens
depends on the size of the items and the size of the container.
CSS also has options for the direction of the wrap:
nowrap: this is the default setting, and does not wrap items.wrap: wraps items from left-to-right if they are in a row, or top-to-bottom if they are in a column.wrap-reverse: wraps items from right-to-left if they are in a row, or bottom-to-top if they are in a column.
1.nowarp
html code
<style> #bx-container { background: gray; display: flex; height: 100%; flex-wrap: ; } #bx-1{ background-color: dodgerblue; width: 25%; height: 50%; } #bx-2 { background-color: orangered; width: 25%; height: 50%; } #bx-3{ background-color: violet; width: 25%; height: 50%; } #bx-4 { background-color: yellow; width: 25%; height: 50%; } #bx-5 { background-color: green; width: 25%; height: 50%; } #bx-6{ background-color: black; width: 25%; height: 50%; } </style> <div id="bx-container"> <div id="bx-1"> </div> <div id="bx-2"> </div> <div id="bx-3"> </div> <div id="bx-4"> </div> <div id="bx-5"> </div> <div id="bx-6"> </div> </div>
Comments
Post a Comment