Flexbox in CSS 03 - Mini Project Using CSS Flex Class Notes - Full Stack Web Development 2.0 (SIGMA 2.0) (Hinglish)
Flexbox in CSS 03 - Mini Project Using CSS Flex Class Notes - Full Stack Web Development 2.0 (SIGMA 2.0) (Hinglish)
properties
PW SKILLS
Topics
● What are Flexbox item properties
● The different types of Flexbox properties, with the example
PW SKILLS
What are Flexbox item properties?
Flexbox provides several properties that are applied to individual flex items within a Flexbox layout.
PW SKILLS
Flex Item properties, with the example
HTML
***- This html is used for all the example **> **>
<body>
<div class="container">
<div class="item item-1">1box*/div>
<div class="item item-2">2box*/div>
<div class="item item-3">3box*/div>
<div class="item item-4">4box*/div>
*/div>
*/body>
PW SKILLS
order
CSS Output
PW SKILLS
align-self
CSS Output
.container {
display: flex;
flex-direction: row;
border: 1px solid black;
color: white;
height: 100px;
}
.item {
width: 50px;
height: 50px;
background-color: blue;
border: 1px solid;
}
** aligning the item 1 to center
*/
.item-1 {
align-self: center;
}
PW SKILLS
flex-grow
CSS Output
.container {
display: flex;
flex-direction: row;
border: 1px solid black;
color: white;
height: 100px;
}
.item {
width: 50px;
height: 50px;
background-color: blue;
border: 1px solid;
}
** flex grow item properties */
.item-1 {
flex-grow: 1;
}
PW SKILLS
flex-shrink
CSS Output
.container {
display: flex;
flex-direction: row;
border: 1px solid black;
color: white;
height: 100px;
}
.item {
width: 50px;
height: 50px;
background-color: blue;
border: 1px solid;
}
** 0 shrink value indicate it
will not shrink
so, item-2 will not shrink.
*/
.item-2 {
flex-shrink: 0;
}
PW SKILLS
flex-basis
Output
.container {
display: flex;
flex-direction: row;
border: 1px solid black;
color: white;
height: 100px;
}
.item {
width: 50px;
height: 50px;
background-color: blue;
border: 1px solid;
}
** change the width of the 2nd
item*/
.item-2 {
flex-basis: 40%;
}
PW SKILLS
flex
Syntax - Output
.container {
display: flex;
flex-direction: row;
border: 1px solid black;
color: white;
}
.item {
width: 50px;
height: 50px;
background-color: blue;
border: 1px solid;
}
** flex - flex grow flex-shrink flex-basis */
.item-1 {
flex: 1 0 200px;
}
.item-2 {
flex: 1 0 400px;
}
PW SKILLS
THANK YOU
PW SKILLS