CSS3 Flexbox: Align-Items: Flex-Start

With the align-items:flex-start; property, the flex-items are positioned at the top of the container, reduced to the size of the content in it. The following example shows the result of using the flex-start value:

HTML file: Displayed by browser:
<style>
.flex-container {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: flex-start;
    align-items: flex-start;
    width: 400px;
    height: 250px;
    background-color: lightgrey;
}
.flex-item {
    background-color: cornflowerblue;
    width: 100px; /* NOTICE THERE IS NO HEIGHT*/
    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>
</body>
flex item 1
flex item 2
flex item 3

Again, without a specified height, the flex-items are aligned to the top of the flex-container.

Back button Table of Contents Next button