-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path43CSSGridAutofit.html
More file actions
45 lines (44 loc) · 1.47 KB
/
43CSSGridAutofit.html
File metadata and controls
45 lines (44 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Grid Autofit Min Max</title>
<style>
.container{
display: grid;
grid-gap: 1rem;
/* grid-template-columns: 1fr 1fr 1fr; */
/* It is use for making responsive website */
/* It is very easy to implement for dealing with media query */
/* auto fit means help to make responsive with adjust screen */
/* In this example minimum width is 400px and maximum width is 1fr */
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
/* justify-content: center;
align-items: center; */
}
.box{
border: 3px solid red;
background-color: lightcoral;
padding: 20px;
}
</style>
</head>
<body>
<div class="container">
<div class="box">Item-1</div>
<div class="box">Item-2</div>
<div class="box">Item-3</div>
<div class="box">Item-4</div>
<div class="box">Item-5</div>
<div class="box">Item-6</div>
<div class="box">Item-7</div>
<div class="box">Item-8</div>
<div class="box">Item-9</div>
<div class="box">Item-10</div>
<div class="box">Item-11</div>
<div class="box">Item-12</div>
</div>
</body>
</html>