summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/flexbox/test/doc_flexbox_specific_cases.html
blob: f5a6aaad24c7bc8e58377e18bfe871dec65bf373 (plain)
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!DOCTYPE html>
<meta charset="utf-8">
<style>
@font-face {
  font-family: Ahem;
  src: url("Ahem.ttf");
}
.container {
  width: 300px;
  height: 150px;
  margin: 10px;
  display: flex;
}
.container.column {
  height: 300px;
  width: 150px;
  flex-direction: column;
}
.item {
  background: #0004;
}
.shrinking .item {
  flex-basis: 500px;
  flex-shrink: 1;
}
.shrinking.is-clamped .item {
  min-width: 350px;
}
.growing .item {
  flex-basis: 200px;
  flex-grow: 1;
}
.growing.is-clamped .item {
  max-width: 250px;
}

#want-to-grow-more-than-max {
  width: 500px;
  display: flex;
}
#want-to-grow-more-than-max div {
  flex: 1;
  max-width: 200px;
}

#did-not-grow-or-shrink {
  width: 500px;
  display: flex;
}
#did-not-grow-or-shrink div {
  flex: 0 300px;
}

#just-enough-space-for-clamped-items {
  display:flex;
  width:100px;
  height:40px
}
#just-enough-space-for-clamped-items div:first-child {
  flex: 1 300px;
  max-width: 20px;
  background: teal;
}
#just-enough-space-for-clamped-items div:last-child {
  flex: 1 10px;
  min-width: 80px;
  background: salmon;
}

#wanted-to-shrink-more-than-basis {
  display: flex;
  width: 5px;
}
#wanted-to-shrink-more-than-basis div:first-child {
  flex: 0 2 200px;
  /* Using the Ahem test font to make sure the text has the exact same size on all test
     platforms */
  font-family: Ahem;
  font-size: 10px;
}
#wanted-to-shrink-more-than-basis div:last-child {
  flex: 0 1 200px;
}
</style>
<div id="container" class="container">
  <div class="item">flex item in a row flex container</div>
</div>
<div class="container column">
  <div class="item">flex item in a column flex container</div>
</div>
<div class="container shrinking">
  <div class="item">Shrinking flex item</div>
</div>
<div class="container shrinking is-clamped">
  <div class="item">Shrinking and clamped flex item</div>
</div>
<div class="container growing">
  <div class="item">Growing flex item</div>
</div>
<div class="container growing is-clamped">
  <div class="item">Growing and clamped flex item</div>
</div>
<div id="want-to-grow-more-than-max">
  <div>item wants to grow more</div>
</div>
<div id="did-not-grow-or-shrink">
  <div>item did not grow or shrink</div>
</div>
<div id="just-enough-space-for-clamped-items">
 <div></div>
 <div></div>
</div>
<div id="wanted-to-shrink-more-than-basis">
  <div>item wants to shrink more than its basis</div>
  <div></div>
</div>
<div class="container" id="container-only">
  <div class="container" id="container-and-item">
    <div id="item-only">This item is inside a container-item element</div>
  </div>
</div>