回答編集履歴

4

modify

2020/01/26 14:58

投稿

liveasnotes
liveasnotes

スコア1284

test CHANGED
@@ -212,7 +212,7 @@
212
212
 
213
213
 
214
214
 
215
- Please write `position: relative` at a parent element if the child element has `position: absolute`. Otherwise, the origin of the element set to parent's parent's parent's...
215
+ Please write `position: relative` at a parent element if the child element has `position: absolute`. Otherwise, the origin of the element will be set to the parent's parent's parent's...parent element.
216
216
 
217
217
 
218
218
 

3

main issue

2020/01/26 14:58

投稿

liveasnotes
liveasnotes

スコア1284

test CHANGED
@@ -205,3 +205,91 @@
205
205
 
206
206
 
207
207
  ```
208
+
209
+
210
+
211
+ # main issue: why `overflow: hidden;` not working
212
+
213
+
214
+
215
+ Please write `position: relative` at a parent element if the child element has `position: absolute`. Otherwise, the origin of the element set to parent's parent's parent's...
216
+
217
+
218
+
219
+ ![イメージ説明](76ee8ea336002e81fd91801e9762c10a.png)
220
+
221
+ ![イメージ説明](ea98f5667bcaa8ef2b763fd4a5982617.png)
222
+
223
+
224
+
225
+ ```html
226
+
227
+ <div id="a">
228
+
229
+ <div id="b">
230
+
231
+ <div id="c">
232
+
233
+ </div>
234
+
235
+ </div>
236
+
237
+ </div>
238
+
239
+ ```
240
+
241
+ ```css
242
+
243
+ #a{
244
+
245
+ border: 1px solid;
246
+
247
+ width: 300px;
248
+
249
+ height: 300px;
250
+
251
+ }
252
+
253
+ #b{
254
+
255
+ /*position: relative;*/
256
+
257
+ width: 200px;
258
+
259
+ height: 200px;
260
+
261
+ background: skyblue;
262
+
263
+ }
264
+
265
+ #c{
266
+
267
+ position: absolute;
268
+
269
+ right: 0;
270
+
271
+ width: 100px;
272
+
273
+ height: 100px;
274
+
275
+ background: palegreen;
276
+
277
+ }
278
+
279
+ ```
280
+
281
+
282
+
283
+ Don't forget `position: relative`! lol
284
+
285
+
286
+
287
+ ```css
288
+
289
+ .content{
290
+
291
+ position: relative;
292
+
293
+ }
294
+
295
+ ```

2

modified

2018/08/22 13:32

投稿

liveasnotes
liveasnotes

スコア1284

test CHANGED
@@ -178,6 +178,8 @@
178
178
 
179
179
  pointer-events: none;
180
180
 
181
+ overflow: hidden;
182
+
181
183
  }
182
184
 
183
185
  99.9%{
@@ -192,8 +194,6 @@
192
194
 
193
195
  height: 0;
194
196
 
195
- overflow: hidden;
196
-
197
197
  }
198
198
 
199
199
  }

1

modified

2018/08/22 13:09

投稿

liveasnotes
liveasnotes

スコア1284

test CHANGED
@@ -21,3 +21,187 @@
21
21
 
22
22
 
23
23
  Please try using them.
24
+
25
+
26
+
27
+ ---
28
+
29
+
30
+
31
+ You don't need use `display: none` to show fadeout-effect.
32
+
33
+
34
+
35
+ Make it simple as you did.
36
+
37
+ ![イメージ説明](f84ab0e7fe66dbbd3d3e63bd9bd722d3.gif)
38
+
39
+
40
+
41
+ ```html
42
+
43
+ <label for="tgl" id="tgl_l">Click me!</label>
44
+
45
+ <div class="of-auto">a
46
+
47
+ <div class="content">
48
+
49
+ <div class="innercontent">B</div>
50
+
51
+ <input type="checkbox" id="tgl">
52
+
53
+ <div class="innercontent2">v</div>
54
+
55
+ </div>
56
+
57
+ </div>
58
+
59
+ ```
60
+
61
+ ```css
62
+
63
+ .of-auto {
64
+
65
+ position: fixed;
66
+
67
+ left: 0;
68
+
69
+ top:1em;
70
+
71
+ overflow: auto;
72
+
73
+ height: 200px;
74
+
75
+ width: 200px;
76
+
77
+ background-color: blue;
78
+
79
+ color: white;
80
+
81
+ }
82
+
83
+
84
+
85
+ .content {
86
+
87
+ overflow: hidden;
88
+
89
+ height: 0;
90
+
91
+ max-height: 0;
92
+
93
+ margin: 0;
94
+
95
+ }
96
+
97
+
98
+
99
+ .innercontent {
100
+
101
+ background-color: red;
102
+
103
+ height:600px;
104
+
105
+ }
106
+
107
+ .innercontent2 {
108
+
109
+ background-color: orange;
110
+
111
+ height:100px;
112
+
113
+ position : absolute;
114
+
115
+ right:0;
116
+
117
+ }
118
+
119
+
120
+
121
+ /*tgl part*/
122
+
123
+
124
+
125
+ #tgl_l{
126
+
127
+ position: fixed;
128
+
129
+ top: 230px;
130
+
131
+ border-radius: 5px;
132
+
133
+ border: 1px solid;
134
+
135
+ padding: .5em;
136
+
137
+ }
138
+
139
+ #tgl{
140
+
141
+ display: none;
142
+
143
+ }
144
+
145
+
146
+
147
+ /*main part*/
148
+
149
+
150
+
151
+ #tgl:checked +.innercontent2{
152
+
153
+ opacity: 0;
154
+
155
+ width: 0;
156
+
157
+ height: 0;
158
+
159
+ overflow: hidden;
160
+
161
+ }
162
+
163
+
164
+
165
+ /* i think this is better than above
166
+
167
+
168
+
169
+ #tgl:checked +.innercontent2{
170
+
171
+ animation: fadeOut .7s forwards;
172
+
173
+ }
174
+
175
+ @keyframes fadeOut{
176
+
177
+ 0%{
178
+
179
+ pointer-events: none;
180
+
181
+ }
182
+
183
+ 99.9%{
184
+
185
+ opacity: 0;
186
+
187
+ }
188
+
189
+ 100%{
190
+
191
+ width: 0;
192
+
193
+ height: 0;
194
+
195
+ overflow: hidden;
196
+
197
+ }
198
+
199
+ }
200
+
201
+
202
+
203
+ */
204
+
205
+
206
+
207
+ ```