FCC---CSS Flexbox: Use the flex-direction Property to Make a Row
Adding display: flex
to an element turns it into a flex container.
This makes it possible to align any children of that element into rows or columns.
You do this by adding the flex-direction
property to the parent item and setting it to row or column.
Creating a row will align the children horizontally, and creating a column will align the children vertically.
Other options for flex-direction
are row-reverse and column-reverse.
Note: The default value for the flex-direction
property is row
.
Add the CSS property flex-direction
to the #box-container
element, and give it a value of row-reverse
.
<style> #box-container { display: flex; height: 500px; flex-direction: row-reverse; } #box-1 { background-color: dodgerblue; width: 50%; height: 50%; } #box-2 { background-color: orangered; width: 50%; height: 50%; } </style> <div id="box-container"> <div id="box-1"></div> <div id="box-2"></div> </div>
from:
to:
相关推荐
xiaohuli 2020-09-02
JackyCan 2020-08-13
Ladyseven 2020-07-25
尚衍亮 2020-02-17
GeolageWu 2019-12-17
dongyang0 2019-12-08
bwshqh 2019-11-18
MaYangyang 2019-11-17
dongyang0 2019-11-03
JackyCan 2015-02-28
clschen 2011-08-05
MaYangyang 2019-07-01
MaYangyang 2019-07-01
dongyang0 2019-07-01
yeluoxiaoxin 2019-07-01
yongquanx 2019-07-01
武林半侠 2019-07-01
GeolageWu 2019-06-30