-
Notifications
You must be signed in to change notification settings - Fork 17
/
flex-shrink-proportionally-relative-to-factor-and-content.html
executable file
·98 lines (85 loc) · 2.39 KB
/
flex-shrink-proportionally-relative-to-factor-and-content.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>Flex items shrink proportionally relative to their shrink factor and content</title>
<link rel="stylesheet" href="c/examples.css"/>
<style>
/* as if flex: 0 1 value; were set */
div {
background-color: rgba(0,0,0,0.1);
}
article {
width: 520px; /* book reads 500. We added 20px to allow for between item padding */
box-sizing: content-box;
}
article > div {
display: flex;
border: 1px dashed;
padding: 2px;
min-height: 100px;
box-sizing: content-box;
flex-wrap: nowrap;
}
div > div {
border: 1px solid;
margin: 2px; /* this makes the extra distributed space available less than 450px */
padding: 40px 0;
font-size: 1.33rem;
box-sizing: content-box;
}
body {
font-size: 25px;
text-align: center;
}
p {
margin-top: 0;
font-family: sans-serif;
}
b {
}
</style>
</head>
<body>
<article>
<div>
<div style="flex-shrink: 1">
<b>flex-shrink: 1</b> is set with a few words
</div>
<div style="flex-shrink: 1; background-color: rgba(0,0,0,0.2);">
This has <b>flex-shrink: 1;</b> and <b>background-color: rgba(0, 0, 0, 0.2);</b> set with a lot of additional text, unlike other flex items across a few lines.
</div>
<div style="flex-shrink: 1">
This too has <b>flex-shrink: 1</b> with a medium amount of extra content.
</div>
</div>
<p>same shrink factors⤴</p>
</article>
<article>
<div>
<div style="flex-shrink: .5">
<b>flex-shrink: 0.5</b> is set with a few words
</div>
<div style="flex-shrink: 1; background-color: rgba(0,0,0,0.2);">
This has <b>flex-shrink: 1;</b> and <b>background-color: rgba(0, 0, 0, 0.2);</b> set with a lot of additional text, unlike other flex items across a few lines.
</div>
<div style="flex-shrink: 1">
This too has <b>flex-shrink: 1</b> with a medium amount of extra content.
</div>
</div>
<p>different shrink factors⤴</p>
</article>
<article>
<div>
<div style="flex-shrink: 0"><b>flex-shrink: 0</b> is set with a few words</div>
<div style="flex-shrink: 0; background-color: rgba(0,0,0,0.2);">
This has <b>flex-shrink: 0;</b> and <b>background-color: rgba(0, 0, 0, 0.2);</b> set with a lot of additional text, unlike other flex items across a few lines.
</div>
<div style="flex-shrink: 0">
This too has <b>flex-shrink: 0</b> with a medium amount of extra content.
</div>
</div>
<p>null shrink factors⤴</p>
</article>
</body>
</html>