質問編集履歴

2

CSSを追記しました

2017/11/24 13:01

投稿

yamady
yamady

スコア176

test CHANGED
File without changes
test CHANGED
File without changes

1

CSSを追記しました

2017/11/24 13:01

投稿

yamady
yamady

スコア176

test CHANGED
File without changes
test CHANGED
@@ -101,3 +101,183 @@
101
101
  </ul>
102
102
 
103
103
  ```
104
+
105
+
106
+
107
+ ```CSS
108
+
109
+ .accordion-box {
110
+
111
+ position: relative;
112
+
113
+ }
114
+
115
+ .accordion-box label {
116
+
117
+ height: 140px; /* グラデーションの高さ */
118
+
119
+ cursor: pointer;
120
+
121
+ text-align: center;
122
+
123
+ font-size: 12px;
124
+
125
+ position: absolute;
126
+
127
+ bottom: 0;
128
+
129
+ width: 100%;
130
+
131
+
132
+
133
+ /* 以下グラデーションは「背景が白」に併せて設定しています */
134
+
135
+ background: -webkit-linear-gradient(top, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.95) 90%);
136
+
137
+ background: -moz-linear-gradient(top, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.95) 90%);
138
+
139
+ background: -o-linear-gradient(top, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.95) 90%);
140
+
141
+ background: -ms-linear-gradient(top, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.95) 90%);
142
+
143
+ background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.95) 90%);
144
+
145
+ }
146
+
147
+ .accordion-box input:checked + label {
148
+
149
+ background: inherit; /* 開いた時には背景グラデーションを消す */
150
+
151
+ }
152
+
153
+ .accordion-box label:after {
154
+
155
+ content: "続きをよむ"; /* ラベルの文字 */
156
+
157
+ letter-spacing: .05em;
158
+
159
+ line-height: 2.5rem;
160
+
161
+ position: absolute;
162
+
163
+ bottom: 20px;
164
+
165
+ left: 50%;
166
+
167
+ -webkit-transform: translate(-50%, 0);
168
+
169
+ transform: translate(-50%, 0);
170
+
171
+ color: #fff;
172
+
173
+ background-color: #000;
174
+
175
+ width: 18.75rem;
176
+
177
+ -webkit-border-radius: 20px;
178
+
179
+ -moz-border-radius: 20px;
180
+
181
+ border-radius: 20px;
182
+
183
+ }
184
+
185
+ .accordion-box label:before {
186
+
187
+ content: "↓";
188
+
189
+ font-weight: 700;
190
+
191
+ position: absolute;
192
+
193
+ bottom: 30px;
194
+
195
+ left: 50%;
196
+
197
+ -webkit-transform: translate(-140px, 0);
198
+
199
+ transform: translate(-140px, 0);
200
+
201
+ background-color: #fff;
202
+
203
+ z-index: 1;
204
+
205
+ -webkit-border-radius: 100%;
206
+
207
+ -moz-border-radius: 100%;
208
+
209
+ border-radius: 100%;
210
+
211
+ width: 20px;
212
+
213
+ height: 20px;
214
+
215
+ line-height: 20px;
216
+
217
+ }
218
+
219
+ .accordion-box input {
220
+
221
+ display: none;
222
+
223
+ }
224
+
225
+ .accordion-box .accordion-container {
226
+
227
+ overflow: hidden;
228
+
229
+ height: 200px; /* 開く前に見えている部分の高さ */
230
+
231
+ -webkit-transition: all 0.1s;
232
+
233
+ -moz-transition: all 0.1s;
234
+
235
+ -ms-transition: all 0.1s;
236
+
237
+ -o-transition: all 0.1s;
238
+
239
+ transition: all 0.1s;
240
+
241
+ }
242
+
243
+
244
+
245
+
246
+
247
+ .accordion-box input:checked + label {
248
+
249
+ /* display: none ; 閉じるボタンは要らないとき */
250
+
251
+ }
252
+
253
+ .accordion-box input:checked + label:after {
254
+
255
+ content: "閉じる";
256
+
257
+ }
258
+
259
+ .accordion-box input:checked + label:before {
260
+
261
+ content: "↑";
262
+
263
+ }
264
+
265
+ .accordion-box input:checked ~ .accordion-container {
266
+
267
+ height: auto;
268
+
269
+ padding-bottom: 80px; /* 閉じるボタンのbottomからの位置 */
270
+
271
+ -webkit-transition: all 0.1s;
272
+
273
+ -moz-transition: all 0.1s;
274
+
275
+ -ms-transition: all 0.1s;
276
+
277
+ -o-transition: all 0.1s;
278
+
279
+ transition: all 0.1s;
280
+
281
+ }
282
+
283
+ ```