flexbox example
Example 1: css flexbox syntax
Display: flex
Flex-direction: row | row-reverse | column | column-reverse
align-self: flex-start | flex-end | center | baseline | stretch
justify-content: start | center | space-between | space-around | space-evenly
Example 2: flexbox in css
/*
Most Common Flexbox properties:
display: flex;
flex-direction: row / column; --> used to justify the direction of content
flex-wrap: wrap; --> holds the content inside flexbox container
These Properties are also part of flexbox and only apply on a container which contain flexbox property
Justify content:
center
start
end
baseline
space-around -->commonly used
Align items:
center
baseline
fr = fill up any available space
*/
.flexbox {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-around;
/* column-count: 2;
columns: 2; */
}
Example 3: flex css end
.item {
align-self:flex-start | flex-end | center | baseline | stretch;
}
Example 4: flex box in css
<html>
<head>
<style>
.parent{
display: flex or inline-flex;
flex-direction: row or column;
flex-wrap: wrap or wrap-reverse;
}
</style>
</head>
<body>
<div class="parent">
<div class="child-1"></div>
.
.
.
</div>
</body>
</html>
Example 5: flexbox css
.container {
align-content: flex-start | flex-end | center | space-between | space-around | space-evenly | stretch | start | end | baseline | first baseline | last baseline + ... safe | unsafe;
}
Example 6: css flexbox layout examples
<div class="container">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
...
</div>