Css Part2
Css Part2
In this pdf , we will talk about the flexbox in css , because it important to manage the item in your website.
If you want to use flexbox in css then you need a display: flex; in the parent container[container is just like box, whick holds the
set of items] .
Now ,suppose we have two file index.html and style.css and file looks like that -:-
index.html style.css
<!DOCTYPE html>
<html lang="en"> .container{
<head>
<meta charset="UTF-8"> height: 100vh;
<meta http-equiv="X-UA-Compatible" content="IE=edge"> display:flex;
<meta name="viewport" content="width=device-width, }
initial-scale=1.0">
<title>css flexbox</title> .box{
</body>
</html>
Output:
Jus fy-content -:-
In jus fy-content have different kind of parameters such as center ,flex-start ,flex-end ,space-between,space-around,space-
evenly.
Now when you add the some jus fy-content property then result will effect like this -:-
style.css
.container{
height: 100vh;
display:flex;
justify-content:center;
}
.box{
width: 100px;
height: 100px;
background-color: red;
color: white;
margin: 5px ;
}
Output :
.container{
In style.css file , if you will replace the line
height: 100vh;
jus fy-content:center; --> jus fy-content:space-between; display:flex;
justify-content:space-between;
}
.box{
width: 100px;
height: 100px;
background-color: red;
color: white;
margin: 5px ;
}
Output:
output:
output:
In style.css file , if you will replace the line
output:
align-items-:-
In align-items have different kind of parameters such as center ,start,end .
Now when you add the some align-items property then result will effect like this -:-
style.css
.container{
height: 100vh;
display:flex;
align-items:start;
}
.box{
width: 100px;
height: 100px;
background-color: red;
color: white;
margin: 5px ;
}
Output:
In style.css file , if you will replace the line
Output:
Flex-direc on-:-
Flex-direc on decides to item , which direc on will be arranged , in column or in row .
By the way we have four type of flex-direc on row , row-reverse, column , column-reverse .
style.css
.container{
height: 100vh;
display:flex;
flex-direction:coloum;
}
.box{
width: 100px;
height: 100px;
background-color: red;
color: white;
margin: 5px ;
}
Output:
In style.css file , if you will replace the line
output:
output: