How to make Flexbox Layout using HTML and CSS.[Source Code]
To make this website, you would like to make two files: an HTML file, a CSS file. First, create an HTML file with the name of index.html and remember, you have to create a file with a .html extension.
/**
Hello Future Developer Thanks for Using learningrobo.com,
Check our website Regularly For New Snippets Post.
Share & Support us
**/
@import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap');
*{
box-sizing: border-box;
margin: 0;
font-family: 'Poppins', sans-serif;
}
.container{
display: flex;
flex-direction: column;
height: 100vh;
width: 100vw;
}
.header{
display: flex;
height: 5vh;
width: 100vw;
background-color: gainsboro;
}
.footer{
display: flex;
height: 5vh;
width: 100vw;
background-color: gainsboro;
}
.mp{
display: flex;
height: 90vh;
width: 100vw;
}
.left{
display: flex;
height: 100%;
width: 5%;
background-color: gainsboro;
}
.right{
display: flex;
height: 100%;
width: 5%;
background-color: gainsboro;
}
.middle{
display: flex;
flex-direction: column;
height: calc(100%-10px);
width: 90%;
margin: 5px;
gap:5px;
}
.p1{
display: flex;
height: 55%;
width: 100%;
gap: 5px;
}
.p1c1{
display: flex;
flex-direction: column;
width: 60%;
height: 100%;
gap: 5px;
}
.p1c1g1{
display: flex;
height: 60%;
width: 100%;
align-items: center;
justify-content: center;
background-color: aqua;
border: 2px solid black;
border-radius: 10px;
}
.p1c1g1:hover{
background-color: blue;
}
.p1c1g2{
display: flex;
height: 40%;
width: 100%;
gap: 5px;
}
.p1c1g2c1{
display: flex;
height: 100%;
width: 60%;
align-items: center;
justify-content: center;
background-color: chartreuse;
border: 2px solid black;
border-radius: 10px;
}
.p1c1g2c1:hover{
background-color: green;
}
.p1c1g2c2{
display: flex;
height: 100%;
width: 40%;
align-items: center;
justify-content: center;
background-color: blueviolet;
border: 2px solid black;
border-radius: 10px;
}
.p1c1g2c2:hover{
background-color: darkmagenta;
}
.p1c2{
display: flex;
width: 40%;
height: 100%;
align-items: center;
justify-content: center;
background-color: wheat;
border: 2px solid black;
border-radius: 10px;
}
.p1c2:hover{
background-color: brown;
}
.p2{
display: flex;
height: 45%;
width: 100%;
gap: 5px;
}
.p2c1{
display: flex;
height: 100%;
width: 35.7%;
align-items: center;
justify-content: center;
background-color: cadetblue;
border: 2px solid black;
border-radius: 10px;
}
.p2c1:hover{
background-color: darkslategrey;
}
.p2c2{
display: flex;
height: 100%;
width: 64%;
align-items: center;
justify-content: center;
background-color: hotpink;
border: 2px solid black;
border-radius: 10px;
}
.p2c2:hover{
background-color:deeppink;
}
@media screen and (max-width:1024px){
.p1, .p2{
flex-direction: column;
}
.p1c1, .p1c2, .p2c1, .p2c2{
width: 90vw;
}
}
@media screen and (max-width:630px){
.p1, .p2, .p1c1g2{
flex-direction: column;
}
.p1c1, .p1c2, .p2c1, .p2c2, .p1c1g2c1, .p1c1g2c2{
width: 90vw;
}
.p1c1{
height: 250%;
}
}
.credit a {
text-decoration: none;
color: #121212;
font-weight: 800;
}
.credit {
color: #121212;
text-align: center;
margin-top: 10px;
font-family: Verdana,Geneva,Tahoma,sans-serif;
}
.credit span{
color:#000;
font-size:20px;
}
Thank you for reading our blog. If you face any problem in Creating a Flexbox Layout using HTML and CSS., then contact us or comment to us. We’ll try to provide a solution to your problem as soon as possible.
Explore
Press The Key ' p ' and say ' read article ' our voice assistant read our article.
In Our older post it doesnot work we working on that.
In Our older post it doesnot work we working on that.
Post a Comment
Thank you
Learning robo team