Skip to content

Commit 9be7f18

Browse files
committed
flexbox challenge
1 parent 677500c commit 9be7f18

File tree

2 files changed

+24
-19
lines changed

2 files changed

+24
-19
lines changed

practice/04 - CSS Layouts/challenge.css

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,13 @@ body {
2828
/* PRODUCT INFORMATION */
2929
.price {
3030
font-size: 24px;
31-
float: left;
3231
}
3332

3433
.shipping {
3534
font-size: 12px;
3635
text-transform: uppercase;
3736
font-weight: bold;
3837
color: #777;
39-
margin-bottom: 20px;
40-
float: right;
41-
margin-top: 8px;
4238
}
4339

4440
.sale {
@@ -68,12 +64,15 @@ body {
6864
text-decoration: none;
6965
}
7066

67+
.product-colors {
68+
display: flex;
69+
gap: 10px;
70+
}
71+
7172
.color {
7273
background-color: #000;
7374
height: 22px;
7475
width: 22px;
75-
display: inline-block;
76-
margin-right: 10px;
7776
}
7877

7978
.color-blue {
@@ -127,28 +126,24 @@ body {
127126
}
128127

129128
.product-description{
130-
clear: both;
131129
margin-bottom: 10px;
132130
}
133131

134132
.product-img{
135133
width: 250px;
136-
float: left;
137-
margin-right: 40px;
138134
}
139135

140136
.product-info {
141137
/* (825 - 8 - 250 - 2 * 40) / 2 */
142-
width: 243px;
143-
float: left;
144-
margin-right: 40px;
138+
/* width: 243px;*/
145139
margin-top: 20px;
140+
flex: 1;
146141
}
147142

148143
.product-details {
149-
width: 243px;
150-
float: left;
144+
/*width: 243px;*/
151145
margin-top: 20px;
146+
flex: 1;
152147
}
153148

154149
.clearfix::after {
@@ -159,4 +154,13 @@ body {
159154

160155
.container {
161156
/*background-color: #94d82d;*/
157+
display: flex;
158+
gap: 40px;
159+
}
160+
161+
.product-price {
162+
display: flex;
163+
align-items: center;
164+
justify-content: space-between;
165+
margin-bottom: 20px;
162166
}

practice/04 - CSS Layouts/challenge.html

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<body>
1212
<article class="product">
1313
<h2 class="product-title">Converse Chuck Taylor All Star Low Top</h2>
14-
<div class="container clearfix">
14+
<div class="container">
1515
<img
1616
alt="Chuck Taylor All Star Shoe"
1717
class="product-img"
@@ -20,18 +20,19 @@ <h2 class="product-title">Converse Chuck Taylor All Star Low Top</h2>
2020
/>
2121

2222
<div class="product-info">
23-
<p class="price"><strong>$65.00</strong></p>
24-
<p class="shipping">Free shipping</p>
23+
<div class="product-price">
24+
<p class="price"><strong>$65.00</strong></p>
25+
<p class="shipping">Free shipping</p>
26+
</div>
2527
<p class="sale">Sale</p>
2628

27-
2829
<p class="product-description">
2930
Ready to dress up or down, these classic canvas Chucks are an everyday
3031
wardrobe staple.
3132
</p>
3233
<a class="more-info" href="https://converse.com" target="_blank">More information &rarr;</a>
3334

34-
<div class="colors">
35+
<div class="product-colors">
3536
<div class="color"></div>
3637
<div class="color color-blue"></div>
3738
<div class="color color-red"></div>

0 commit comments

Comments
 (0)