Flex-Shrink tutorial in Flexbox CSS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Flex Shrink Flexbox CSS</title>
<link rel="stylesheet" href="css/Flex_Shrink_Flexbox_CSS.css">
</head>
<body>
<h1>Hello World : CSS Flex-Shrink</h1>
<div class="container">
<div class="items item1">One</div>
<div class="items item2">Two</div>
<div class="items item3">Three</div>
<div class="items item4">Four</div>
</div>
</body>
</html>
Below File is css/Flex_Shrink_Flexbox_CSS.css File
body {
font-family: arial, helvetica;
}
h1 {
padding: 0 0 0 40px;
}
.container {
background: #eee;
margin: 50px;
padding: 0px;
border: 3px solid #000;
display: flex;
}
.item1 {
background: #ff4500;
/* Be default, flex-shrink: 1 */
/* flex-basis: 200px;
flex-shrink: 1; */
/* flex: flex-grow flex-shrink flex-basis */
flex: 0 1 200px;
}
.item2 {
background: #9acd32;
}
.item3 {
background: #9370d8;
}
.item4 {
background: #ff69b4;
flex-grow: 1;
}
.items {
color: #fff;
font-size: 20px;
font-weight: bold;
text-align: center;
padding: 0px;
margin: 0px;
height: 60px;
}
.png)
Comments
Post a Comment