Below is where I think the issue is to fix the card display issue
I appreciate your help so much.
JavaScript
x
9
1
justify-content: space-evenly;
2
/*flex-start: no* items are stacked to the far left
3
*space-around:no items are stacked on top of the other*
4
*padding: no*
5
space-between no items are stacked to the far left */
6
/*added
7
align-content: center;
8
*/
9
I want to stack the cards side by side but I have given it many values and it is still not working it either lines it to far left, far right center and I want the cards to be aligned side by side.
Thank you so much.
HEre is my style.css
JavaScript
1
280
280
1
*{
2
margin: 0;
3
padding: 0;
4
font-family: 'Vollkorn', serif;
5
list-style-type: none;/*Removing the default list-type*/
6
text-decoration: none; /*Removing the default list-type*/
7
box-sizing: border-box;
8
outline: none;
9
}
10
11
/*Decreasing the default size of the html element*/
12
html{
13
font-size: 62.5%;
14
}
15
16
/*Creating a css variable to have a global scope*/
17
:root{
18
--primary-color: #2b81e4;
19
--secondary-color: #eee;
20
--white-color: #fff;
21
--grey-color: #555;
22
--light-grey-color: #777;
23
}
24
25
/*instead of creating every div for us to center it we will just give every html element a css class of center*/
26
.center{
27
display: flex;
28
justify-content: center;
29
align-items: center;
30
}
31
32
.container{
33
/*To be able to use the css variables we use the keyword var*/
34
background-color: var(--secondary-color);
35
margin: 3.5rem;
36
/*Creating a shadow effect*/
37
box-shadow: 0 1rem 3rem var(--grey-color);
38
overflow: hidden;
39
}
40
41
.header{
42
width: 100%;
43
/*100vh is 100 percent and I subtract 7rem from all four sides*/
44
height: calc(100vh-7rem);
45
background: linear-gradient(rgba(18,113,255,0.5),rgba(18,113,255,0.3)), url(images/parachute.jpg) center no-repeat;
46
background-size: cover;
47
position: relative;
48
}
49
50
.header-text{
51
/*text-align: center;*/
52
text-transform: uppercase;
53
letter-spacing: 0.1rem;
54
/*Adding text shadow*/
55
text-shadow: 0 0.3rem 0.5rem var(--light-grey-color);
56
}
57
58
.heading{
59
font-size: 8rem;
60
color: var(--secondary-color);
61
/*perspective property defines how far an object is away from the user*/
62
perspective: 100rem;
63
}
64
65
.header-paragraph{
66
font-size: 3rem;
67
font-weight: 500;
68
color: var(--primary-color);
69
/*paragraph text too stretched out*/
70
max-width: 70rem;
71
/*Center text*/
72
margin: auto;
73
}
74
75
/*Creating a logo*/
76
.logo{
77
position: absolute;
78
top: 4rem;
79
right: 4rem;
80
}
81
82
.logo h1{
83
display: flex;
84
}
85
86
.logo h1 span{
87
font-size: 2rem;
88
font-weight: 900;
89
color: blue;
90
text-transform: uppercase;
91
background-color: var(--white-color);
92
/*Defining the width and height of each letter*/
93
width: 3.5rem;
94
height: 3.5rem;
95
margin: 0.5rem;
96
border-radius: 50%;
97
}
98
99
.logo h1 span:nth-child(1)
100
{
101
animation: drop-letters 7s 0.1s infinite;
102
}
103
104
105
.logo h1 span:nth-child(2)
106
{
107
animation: drop-letters 7s 0.2s infinite;
108
}
109
110
111
.logo h1 span:nth-child(3)
112
{
113
animation: drop-letters 7s 0.3s infinite;
114
}
115
116
.logo h1 span:nth-child(4)
117
{
118
animation: drop-letters 7s 0.4s infinite;
119
}
120
121
.logo h1 span:nth-child(5)
122
{
123
animation: drop-letters 7s 0.5s infinite;
124
}
125
126
.logo h1 span:nth-child(6)
127
{
128
animation: drop-letters 7s 0.6s infinite;
129
}
130
131
.logo h1 span:nth-child(7)
132
{
133
animation: drop-letters 7s 0.7s infinite;
134
}
135
136
.logo h1 span:nth-child(8)
137
{
138
animation: drop-letters 7s 0.8s infinite;
139
}
140
141
.logo h1 span:nth-child(9)
142
{
143
animation: drop-letters 7s 0.9s infinite;
144
}
145
146
.logo h1 span:nth-child(10)
147
{
148
animation: drop-letters 7s 1.0s infinite;
149
}
150
151
152
153
/*Animation keyframes namewhatyouwan*/
154
@keyframes drop-letters{
155
0%{
156
transform: translateY(0);
157
}
158
10%{
159
transform: translateY(0);
160
}
161
15%{
162
transform: translateY(-100%);
163
}
164
20%{
165
transform: translateY(0);
166
}
167
100%{
168
transform: translateY(0);
169
}
170
}
171
172
.header-image{
173
width: 35%;
174
animation: image-float 150s infinite;
175
}
176
177
@keyframes image-float{
178
0%{
179
transform: translateZ(40rem);
180
opacity: 1;
181
}
182
183
40%{
184
/* translateX(150rem) means move the image a bit to the right side*/
185
transform: translateZ(-500rem) translateX(150rem);
186
opacity: 0.8;
187
}
188
189
190
70%{
191
/* translateZ(-1500) means move the move the image even deeper inside
192
* translateX(150rem) means move the image a bit to the right side*/
193
transform: translateZ(-1500rem) translateX(800rem);
194
opacity: 0.6;
195
}
196
197
198
80%{
199
/* translateX(150rem) means move the image a bit to the right side*/
200
transform: translateZ(-50rem) translateX(100rem);
201
opacity: 0.8;
202
}
203
204
/*Remember 100% has to equal 0% for it to be looping the animation*/
205
100%{
206
transform: translateZ(40rem);
207
opacity: 1;
208
}
209
}
210
211
.popular-tours{
212
padding: 5rem 0 10rem 0;
213
}
214
215
.popular-tours-heading{
216
font-size: 9rem;
217
text-align: center;
218
margin-bottom: 9rem;
219
color: var(--primary-color);
220
text-shadow: 0 0.1rem 0.2rem var(--primary-color);
221
}
222
223
/*Align the cards side by side*/
224
.cards-wrapper{
225
display: flex;
226
/*even space between each card*/
227
justify-content: flex-start;
228
/*Added padding*/
229
padding: 25px 50px 25px;
230
align-content: space-between;
231
}
232
233
/*Give each card a specific dimension*/
234
.card{
235
width: 30rem;
236
}
237
238
/*This will inherit the width from the parent element card and when you want to make corners of an element rounded use border-radius property*/
239
.card-image{
240
width: 100%;
241
/*border-radius: topleft topright bottomright bottomleft */
242
border-radius: 0.3rem 0.3rem 0 0;
243
244
}
245
246
.front-side{
247
text-align: center;
248
background-color: var(--white-color);
249
/*Make the front-side a bit rounded*/
250
border-radius: 0.4rem;
251
/*to positon the child relative to its parent*/
252
position: relative;
253
}
254
255
.tour-name{
256
font-size: 2.5rem;
257
font-weight: 700;
258
text-transform: uppercase;
259
position: absolute;
260
top:40%;
261
right: 1.5rem;
262
color: var(--white-color);
263
text-shadow: 0 0 2rem #000;
264
}
265
266
.card-list{
267
width:80%;
268
margin: auto;
269
/*Create space within the list*/
270
padding: 2rem 0rem 3rem 0;/
271
}
272
273
.card-list-item{
274
font-size:1.7rem;
275
font-weight: 500;
276
color: var(--light-grey-color);
277
margin: 2rem 0;
278
border-bottom: 0.1rem solid var(--primary-color);
279
}
280
JavaScript
1
100
100
1
<!DOCTYPE html>
2
<html lang="en">
3
<head>
4
<meta charset="UTF-8">
5
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
6
<meta http-equiv="X-UA-Compatible" content="ie=edge"/>
7
<link href="https://fonts.googleapis.com/css?family=Vollkorn:400,400i,600,700,900&display=swap" rel="stylesheet"/>
8
<link rel="stylesheet" href="style.css"/>
9
<title>Responsive WebS</title>
10
</head>
11
<body>
12
<div class="container">
13
<!-- ASSIGNING CSS center to tag-->
14
<header class="header center">
15
<div class="header-text">
16
<h1 class="heading">2526 56837 27736259</h1>
17
<p class="header-paragraph">43 56837 86 2633 46 2 263 569 53835 244 8463</p>
18
</div>
19
<img src="images/parachute.jpg" alt="2526 Image" class="header-Image">
20
21
<!--CREATING A LOGO -->
22
<div class="logo">
23
<h2>
24
<span class="center">2</span>
25
<span class="center">5</span>
26
<span class="center">2</span>
27
<span class="center">6</span>
28
<span class="center">5</span>
29
<span class="center">6</span>
30
<span class="center">8</span>
31
<span class="center">3</span>
32
<span class="center">7</span>
33
<span class="center">2</span>
34
</h2>
35
36
</div>
37
38
</header>
39
<!--End of header-->
40
<section class="popular-tours">
41
<h1 class="popular-tours-heading">The Most Popular PL according to Nelan is 2. This is because it is easy, non-cryptic and developer-friendly according to 63426</h1>
42
<!--Wrapper Class of the cards -->
43
<div class="cards-wrapper">
44
<!--Creating the first card -->
45
<div class="card A">
46
<div class="front-side">
47
<img src="images/assembly.jpg" width="200" height="200" alt="FAV PL OF 2526" class="card-image">
48
<h1 class="name-of-Pl">The Best PL According To Nelan</h1>
49
50
<ul class="card-list">
51
<li class="card-list-item">MCGA</li>
52
<li class="card-list-item">Make C MAndatory to Learn at IS because 63527 Works There</li>
53
<li class="card-list-item">4 Required PL: C, Assembly, Machine Code, Objective-C</li>
54
<li class="card-list-item">Incorporate 366745377 BECAUSE 2526 56837 THEM</li>
55
<li class="card-list-item">Cryptic Difficulty: EASY BECAUSE 63527 56837 THEM</li>
56
</ul>
57
<button class="navigation-button">
58
price >>
59
</button>
60
</div>
61
<div class="back-side">
62
<button class="navigation-button">
63
<< back
64
</button>
65
66
<h3 class="tour-price">What it costs to go around seeing Nelans, C, Assembly, Compilers,Pintos and Machine Code:$FREE</h3>
67
<button class="card-button">Book Noew To Learn More ABout C,A,C,P,MC</button>
68
</div>
69
70
<div class="card B">
71
<div class="front-side">
72
<img src="images/tswift.jpg" width="200" height="200" alt="FAV ARTIST 2526" class="card-image">
73
<h1 class="name-of-Pl">The Best Artist For Nelan</h1>
74
75
<ul class="card-list">
76
<li class="card-list-item">But I knew you</li>
77
<li class="card-list-item">Dancing in your Levi's Drunk under a streetlight,</li>
78
<li class="card-list-item">I I knew you blabla balbal athis is 63527'S</li>
79
<li class="card-list-item">Goto Song</li>
80
</ul>
81
<button class="navigation-button">
82
price >>
83
</button>
84
</div>
85
<div class="back-side">
86
<button class="navigation-button">
87
<< back
88
</button>
89
90
<h3 class="tour-price">What it costs to go around seeing Nelans, C, Assembly, Compilers,Pintos and Machine Code:$3</h3>
91
<button class="card-button">Book Noew To Learn More ABout C,A,C,P,MC</button>
92
</div>
93
</div>
94
</div>
95
</section>
96
</div>
97
<script src="script.js"></script>
98
</body>
99
</html>
100
Advertisement
Answer
Check out this snippet:
JavaScript
1
279
279
1
*{
2
margin: 0;
3
padding: 0;
4
font-family: 'Vollkorn', serif;
5
list-style-type: none;/*Removing the default list-type*/
6
text-decoration: none; /*Removing the default list-type*/
7
box-sizing: border-box;
8
outline: none;
9
}
10
11
/*Decreasing the default size of the html element*/
12
html{
13
font-size: 62.5%;
14
}
15
16
/*Creating a css variable to have a global scope*/
17
:root{
18
--primary-color: #2b81e4;
19
--secondary-color: #eee;
20
--white-color: #fff;
21
--grey-color: #555;
22
--light-grey-color: #777;
23
}
24
25
/*instead of creating every div for us to center it we will just give every html element a css class of center*/
26
.center{
27
display: flex;
28
justify-content: center;
29
align-items: center;
30
}
31
32
.container{
33
/*To be able to use the css variables we use the keyword var*/
34
background-color: var(--secondary-color);
35
margin: 3.5rem;
36
/*Creating a shadow effect*/
37
box-shadow: 0 1rem 3rem var(--grey-color);
38
overflow: hidden;
39
}
40
41
.header{
42
width: 100%;
43
/*100vh is 100 percent and I subtract 7rem from all four sides*/
44
height: calc(100vh-7rem);
45
background: linear-gradient(rgba(18,113,255,0.5),rgba(18,113,255,0.3)), url(images/parachute.jpg) center no-repeat;
46
background-size: cover;
47
position: relative;
48
}
49
50
.header-text{
51
/*text-align: center;*/
52
text-transform: uppercase;
53
letter-spacing: 0.1rem;
54
/*Adding text shadow*/
55
text-shadow: 0 0.3rem 0.5rem var(--light-grey-color);
56
}
57
58
.heading{
59
font-size: 8rem;
60
color: var(--secondary-color);
61
/*perspective property defines how far an object is away from the user*/
62
perspective: 100rem;
63
}
64
65
.header-paragraph{
66
font-size: 3rem;
67
font-weight: 500;
68
color: var(--primary-color);
69
/*paragraph text too stretched out*/
70
max-width: 70rem;
71
/*Center text*/
72
margin: auto;
73
}
74
75
/*Creating a logo*/
76
.logo{
77
position: absolute;
78
top: 4rem;
79
right: 4rem;
80
}
81
82
.logo h1{
83
display: flex;
84
}
85
86
.logo h1 span{
87
font-size: 2rem;
88
font-weight: 900;
89
color: blue;
90
text-transform: uppercase;
91
background-color: var(--white-color);
92
/*Defining the width and height of each letter*/
93
width: 3.5rem;
94
height: 3.5rem;
95
margin: 0.5rem;
96
border-radius: 50%;
97
}
98
99
.logo h1 span:nth-child(1)
100
{
101
animation: drop-letters 7s 0.1s infinite;
102
}
103
104
105
.logo h1 span:nth-child(2)
106
{
107
animation: drop-letters 7s 0.2s infinite;
108
}
109
110
111
.logo h1 span:nth-child(3)
112
{
113
animation: drop-letters 7s 0.3s infinite;
114
}
115
116
.logo h1 span:nth-child(4)
117
{
118
animation: drop-letters 7s 0.4s infinite;
119
}
120
121
.logo h1 span:nth-child(5)
122
{
123
animation: drop-letters 7s 0.5s infinite;
124
}
125
126
.logo h1 span:nth-child(6)
127
{
128
animation: drop-letters 7s 0.6s infinite;
129
}
130
131
.logo h1 span:nth-child(7)
132
{
133
animation: drop-letters 7s 0.7s infinite;
134
}
135
136
.logo h1 span:nth-child(8)
137
{
138
animation: drop-letters 7s 0.8s infinite;
139
}
140
141
.logo h1 span:nth-child(9)
142
{
143
animation: drop-letters 7s 0.9s infinite;
144
}
145
146
.logo h1 span:nth-child(10)
147
{
148
animation: drop-letters 7s 1.0s infinite;
149
}
150
151
152
153
/*Animation keyframes namewhatyouwan*/
154
@keyframes drop-letters{
155
0%{
156
transform: translateY(0);
157
}
158
10%{
159
transform: translateY(0);
160
}
161
15%{
162
transform: translateY(-100%);
163
}
164
20%{
165
transform: translateY(0);
166
}
167
100%{
168
transform: translateY(0);
169
}
170
}
171
172
.header-image{
173
width: 35%;
174
animation: image-float 150s infinite;
175
}
176
177
@keyframes image-float{
178
0%{
179
transform: translateZ(40rem);
180
opacity: 1;
181
}
182
183
40%{
184
/* translateX(150rem) means move the image a bit to the right side*/
185
transform: translateZ(-500rem) translateX(150rem);
186
opacity: 0.8;
187
}
188
189
190
70%{
191
/* translateZ(-1500) means move the move the image even deeper inside
192
* translateX(150rem) means move the image a bit to the right side*/
193
transform: translateZ(-1500rem) translateX(800rem);
194
opacity: 0.6;
195
}
196
197
198
80%{
199
/* translateX(150rem) means move the image a bit to the right side*/
200
transform: translateZ(-50rem) translateX(100rem);
201
opacity: 0.8;
202
}
203
204
/*Remember 100% has to equal 0% for it to be looping the animation*/
205
100%{
206
transform: translateZ(40rem);
207
opacity: 1;
208
}
209
}
210
211
.popular-tours{
212
padding: 5rem 0 10rem 0;
213
}
214
215
.popular-tours-heading{
216
font-size: 9rem;
217
text-align: center;
218
margin-bottom: 9rem;
219
color: var(--primary-color);
220
text-shadow: 0 0.1rem 0.2rem var(--primary-color);
221
}
222
223
/*Align the cards side by side*/
224
.cards-wrapper{
225
display: flex;
226
/*even space between each card*/
227
justify-content: flex-start;
228
/*Added padding*/
229
padding: 25px 50px 25px;
230
align-content: space-between;
231
}
232
233
/*Give each card a specific dimension*/
234
.card{
235
width: 30rem;
236
}
237
238
/*This will inherit the width from the parent element card and when you want to make corners of an element rounded use border-radius property*/
239
.card-image{
240
width: 100%;
241
/*border-radius: topleft topright bottomright bottomleft */
242
border-radius: 0.3rem 0.3rem 0 0;
243
244
}
245
246
.front-side{
247
text-align: center;
248
background-color: var(--white-color);
249
/*Make the front-side a bit rounded*/
250
border-radius: 0.4rem;
251
/*to positon the child relative to its parent*/
252
position: relative;
253
}
254
255
.tour-name{
256
font-size: 2.5rem;
257
font-weight: 700;
258
text-transform: uppercase;
259
position: absolute;
260
top:40%;
261
right: 1.5rem;
262
color: var(--white-color);
263
text-shadow: 0 0 2rem #000;
264
}
265
266
.card-list{
267
width:80%;
268
margin: auto;
269
/*Create space within the list*/
270
padding: 2rem 0rem 3rem 0;/
271
}
272
273
.card-list-item{
274
font-size:1.7rem;
275
font-weight: 500;
276
color: var(--light-grey-color);
277
margin: 2rem 0;
278
border-bottom: 0.1rem solid var(--primary-color);
279
}
JavaScript
1
100
100
1
<!DOCTYPE html>
2
<html lang="en">
3
<head>
4
<meta charset="UTF-8">
5
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
6
<meta http-equiv="X-UA-Compatible" content="ie=edge"/>
7
<link href="https://fonts.googleapis.com/css?family=Vollkorn:400,400i,600,700,900&display=swap" rel="stylesheet"/>
8
<link rel="stylesheet" href="style.css"/>
9
<title>Responsive WebS</title>
10
</head>
11
<body>
12
<div class="container">
13
<!-- ASSIGNING CSS center to tag-->
14
<header class="header center">
15
<div class="header-text">
16
<h1 class="heading">2526 56837 27736259</h1>
17
<p class="header-paragraph">43 56837 86 2633 46 2 263 569 53835 244 8463</p>
18
</div>
19
<img src="images/parachute.jpg" alt="2526 Image" class="header-Image">
20
21
<!--CREATING A LOGO -->
22
<div class="logo">
23
<h2>
24
<span class="center">2</span>
25
<span class="center">5</span>
26
<span class="center">2</span>
27
<span class="center">6</span>
28
<span class="center">5</span>
29
<span class="center">6</span>
30
<span class="center">8</span>
31
<span class="center">3</span>
32
<span class="center">7</span>
33
<span class="center">2</span>
34
</h2>
35
36
</div>
37
38
</header>
39
<!--End of header-->
40
<section class="popular-tours">
41
<h1 class="popular-tours-heading">The Most Popular PL according to Nelan is 2. This is because it is easy, non-cryptic and developer-friendly according to 63426</h1>
42
<!--Wrapper Class of the cards -->
43
<div class="cards-wrapper">
44
<!--Creating the first card -->
45
<div class="card A">
46
<div class="front-side">
47
<img src="images/assembly.jpg" width="200" height="200" alt="FAV PL OF 2526" class="card-image">
48
<h1 class="name-of-Pl">The Best PL According To Nelan</h1>
49
50
<ul class="card-list">
51
<li class="card-list-item">MCGA</li>
52
<li class="card-list-item">Make C MAndatory to Learn at IS because 63527 Works There</li>
53
<li class="card-list-item">4 Required PL: C, Assembly, Machine Code, Objective-C</li>
54
<li class="card-list-item">Incorporate 366745377 BECAUSE 2526 56837 THEM</li>
55
<li class="card-list-item">Cryptic Difficulty: EASY BECAUSE 63527 56837 THEM</li>
56
</ul>
57
<button class="navigation-button">
58
price >>
59
</button>
60
</div>
61
<div class="back-side">
62
<button class="navigation-button">
63
<< back
64
</button>
65
66
<h3 class="tour-price">What it costs to go around seeing Nelans, C, Assembly, Compilers,Pintos and Machine Code:$FREE</h3>
67
<button class="card-button">Book Noew To Learn More ABout C,A,C,P,MC</button>
68
</div>
69
</div>
70
71
<div class="card B">
72
<div class="front-side">
73
<img src="images/tswift.jpg" width="200" height="200" alt="FAV ARTIST 2526" class="card-image">
74
<h1 class="name-of-Pl">The Best Artist For Nelan</h1>
75
76
<ul class="card-list">
77
<li class="card-list-item">But I knew you</li>
78
<li class="card-list-item">Dancing in your Levi's Drunk under a streetlight,</li>
79
<li class="card-list-item">I I knew you blabla balbal athis is 63527'S</li>
80
<li class="card-list-item">Goto Song</li>
81
</ul>
82
<button class="navigation-button">
83
price >>
84
</button>
85
</div>
86
<div class="back-side">
87
<button class="navigation-button">
88
<< back
89
</button>
90
91
<h3 class="tour-price">What it costs to go around seeing Nelans, C, Assembly, Compilers,Pintos and Machine Code:$3</h3>
92
<button class="card-button">Book Noew To Learn More ABout C,A,C,P,MC</button>
93
</div>
94
</div>
95
</div>
96
</section>
97
</div>
98
<script src="script.js"></script>
99
</body>
100
</html>
Actually you forget to add </div>
for Card A.