CSS3 Flexbox: Flex-Direction: Column

The flex-direction:column will lay out the items vertically, if the writing system is horizontal. The following example shows the result of using the column value:

HTML file: Displayed by browser:
<style>
.flex-container {
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    width: 400px;
    height: 250px;
    background-color: lightgrey;
}
.flex-item {
    background-color: cornflowerblue;
    width: 100px;
    height: 100px;
    margin: 10px;
}
</style>
<body>
<div class="flex-container">
    <div class="flex-item">flex item 1</div>
    <div class="flex-item">flex item 2</div>
    <div class="flex-item">flex item 3</div>
</div>
<p>The flex boxes are rendered with Item 1 at the top.</p>
</body>
flex item 1
flex item 2
flex item 3

The flex boxes are rendered with Item 1 at the top.


Back button Table of Contents Next button