回答編集履歴
1
修正
answer
CHANGED
@@ -21,4 +21,108 @@
|
|
21
21
|
padding: 30px;
|
22
22
|
background: #f00;
|
23
23
|
}
|
24
|
+
```
|
25
|
+
|
26
|
+
---
|
27
|
+
|
28
|
+
追記:
|
29
|
+
最終的な姿がわからないので勘になってしまいますが、こちらでいかがでしょうか?
|
30
|
+
<label>内に<input type="checkbox">を置くと、「サイト利用規約」など文字の部分も押せるようになるので
|
31
|
+
そのようにしています。
|
32
|
+
|
33
|
+
```HTML
|
34
|
+
<div class="ac-container">
|
35
|
+
<div>
|
36
|
+
<label for="ac-1">
|
37
|
+
<input id="ac-1" name="accordion-1" type="checkbox">
|
38
|
+
サイト利用規約
|
39
|
+
</label>
|
40
|
+
<label for="ac-1">
|
41
|
+
<input id="ac-2" name="accordion-2" type="checkbox">
|
42
|
+
個人情報保護方針
|
43
|
+
</label>
|
44
|
+
</div>
|
45
|
+
</div>
|
46
|
+
```
|
47
|
+
```CSS
|
48
|
+
.ac-container {
|
49
|
+
width: auto;
|
50
|
+
margin: 30px auto;
|
51
|
+
text-align: center;
|
52
|
+
|
53
|
+
display: flex; /* 追加 */
|
54
|
+
justify-content: center; /* 追加 */
|
55
|
+
}
|
56
|
+
.ac-container label {
|
57
|
+
/* width: 75%; */
|
58
|
+
text-align: left;
|
59
|
+
background: #e6eae3;
|
60
|
+
margin: 0 auto;
|
61
|
+
padding: 5px 5px 5px 5px;
|
62
|
+
position: relative;
|
63
|
+
display: block;
|
64
|
+
height: 40px;
|
65
|
+
cursor: pointer;
|
66
|
+
color: #56564b;
|
67
|
+
}
|
68
|
+
|
69
|
+
.ac-container label:hover {
|
70
|
+
background: #d4dcd6;
|
71
|
+
-webkit-transition: all .3s;
|
72
|
+
transition: all .3s;
|
73
|
+
}
|
74
|
+
|
75
|
+
.ac-container label:before {
|
76
|
+
color: #56564b;
|
77
|
+
font-family: "FontAwesome";
|
78
|
+
content: "\f055";
|
79
|
+
}
|
80
|
+
|
81
|
+
.ac-container input:checked~label::before {
|
82
|
+
color: #56564b;
|
83
|
+
font-family: "FontAwesome";
|
84
|
+
content: "\f056";
|
85
|
+
}
|
86
|
+
|
87
|
+
.ac-container input {
|
88
|
+
display: none;
|
89
|
+
}
|
90
|
+
/*
|
91
|
+
.ac-container div {
|
92
|
+
background: rgba(255, 255, 255, 0.5);
|
93
|
+
margin-top: -1px;
|
94
|
+
overflow: hidden;
|
95
|
+
height: 0px;
|
96
|
+
position: relative;
|
97
|
+
z-index: 10;
|
98
|
+
transition: height 0.3s ease-in-out, box-shadow 0.6s linear;
|
99
|
+
}
|
100
|
+
*/
|
101
|
+
|
102
|
+
.ac-container input:checked~div {
|
103
|
+
transition: height 0.5s ease-in-out, box-shadow 0.1s linear;
|
104
|
+
box-shadow: 0px 0px 0px 1px rgba(155, 155, 155, 0.3);
|
105
|
+
}
|
106
|
+
|
107
|
+
.ac-container div p {
|
108
|
+
color: #777;
|
109
|
+
line-height: 23px;
|
110
|
+
font-size: 14px;
|
111
|
+
padding: 20px;
|
112
|
+
}
|
113
|
+
|
114
|
+
|
115
|
+
/* 高さの定義 */
|
116
|
+
|
117
|
+
.ac-container input:checked~div.ac-small {
|
118
|
+
height: auto;
|
119
|
+
}
|
120
|
+
|
121
|
+
.ac-container input:checked~div.ac-medium {
|
122
|
+
height: 200px;
|
123
|
+
}
|
124
|
+
|
125
|
+
.ac-container input:checked~div.ac-large {
|
126
|
+
height: 300px;
|
127
|
+
}
|
24
128
|
```
|