Skip to content

Commit 5ac7094

Browse files
committed
Add: demo for min-width, max-width
1 parent 087ee50 commit 5ac7094

File tree

2 files changed

+60
-3
lines changed

2 files changed

+60
-3
lines changed

css_flexbox/base.css

+48-3
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ a:active {
264264
display: flex;
265265
flex-direction: row;
266266
flex-wrap: wrap;
267-
gap: 5px;
267+
gap: 5px;
268268
/* align-items: center; */
269269
/* The align-content property has no effect on single-line flex boxes */
270270
/* align-content: flex-start; */
@@ -289,7 +289,7 @@ a:active {
289289
display: flex;
290290
flex-direction: row;
291291
flex-wrap: wrap;
292-
gap: 5px;
292+
gap: 5px;
293293
align-content: center;
294294
}
295295

@@ -303,7 +303,7 @@ a:active {
303303
display: flex;
304304
flex-direction: row;
305305
flex-wrap: wrap;
306-
gap: 5px;
306+
gap: 5px;
307307
}
308308

309309
.container-j__content-a {
@@ -317,6 +317,51 @@ a:active {
317317
box-sizing: border-box;
318318
}
319319

320+
/*
321+
Note: as soon as you use flex-basis, the width property (if direction row)
322+
is ignored. Both min-width and max-width can be used to clamp the size.
323+
*/
324+
325+
.container-k {
326+
border: solid 2px aquamarine;
327+
display: flex;
328+
flex-direction: row;
329+
}
330+
331+
.container-k .box {
332+
padding: 0;
333+
}
334+
335+
.container-k__content-a {
336+
flex: 0 0 100px;
337+
}
338+
339+
.container-k__content-a p {
340+
background: gold;
341+
}
342+
343+
.container-k__content-b {
344+
flex: 1 1 auto;
345+
min-width: 100px;
346+
max-width: 300px;
347+
}
348+
349+
.container-k__content-b p {
350+
background: pink;
351+
}
352+
353+
.container-k__content-c {
354+
flex: 1 1 auto;
355+
min-width: 100px;
356+
max-width: 200px;
357+
margin-left: auto;
358+
}
359+
360+
.container-k__content-c p {
361+
background: green;
362+
}
363+
364+
320365

321366
/* COMPONENTS ------------------------------------------------------------- */
322367

css_flexbox/index.html

+12
Original file line numberDiff line numberDiff line change
@@ -213,5 +213,17 @@ <h1>Flexbox Items Properties.</h1>
213213
</div>
214214
</div>
215215

216+
<div class="container-k">
217+
<div class="container-k__content-a box">
218+
<p>A</p>
219+
</div>
220+
<div class="container-k__content-b box">
221+
<p>B</p>
222+
</div>
223+
<div class="container-k__content-c box">
224+
<p>C</p>
225+
</div>
226+
</div>
227+
216228
</body>
217229
</html>

0 commit comments

Comments
 (0)