-
Notifications
You must be signed in to change notification settings - Fork 0
/
Card using Grid Auto-Fit vs Auto-Fill.html
84 lines (66 loc) · 2.27 KB
/
Card using Grid Auto-Fit vs Auto-Fill.html
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!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>Document</title>
<style>
body{
font-family: Verdana, Geneva, Tahoma, sans-serif;
}
.container{
/* border: 2px solid red; */
display: grid;
/* grid-template-columns: repeat(no.of columns, minmax(min-value, max-value)); */
grid-template-columns: repeat(auto-fit, minmax(15.62rem, 1fr));
grid-gap: 2rem;
margin: 2rem;
}
.card{
/* border: 2px solid green; */
box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.2);
}
.card img{
object-fit: cover;
/* border: 2px solid blue; */
width: 100%;
}
.CardTextContainer{
margin: 1rem;
}
</style>
</head>
<body>
<div class="container">
<div class="card">
<img src="https://source.unsplash.com/collection/190727/1600x900" alt="random image">
<div class="CardTextContainer">
<h4>John Doe</h4>
<p>Lorem ipsum dolor sit amet.</p>
</div>
</div>
<div class="card">
<img src="https://source.unsplash.com/collection/190727/1600x900" alt="random image">
<div class="CardTextContainer">
<h4>John Doe</h4>
<p>Lorem ipsum dolor sit amet.</p>
</div>
</div>
<div class="card">
<img src="https://source.unsplash.com/collection/190727/1600x900" alt="random image">
<div class="CardTextContainer">
<h4>John Doe</h4>
<p>Lorem ipsum dolor sit amet.</p>
</div>
</div>
<div class="card">
<img src="https://source.unsplash.com/collection/190727/1600x900" alt="random image">
<div class="CardTextContainer">
<h4>John Doe</h4>
<p>Lorem ipsum dolor sit amet.</p>
</div>
</div>
</div>
</body>
</html>