回答編集履歴
1
修正後のCSS全文を追記しました。
answer
CHANGED
@@ -21,4 +21,67 @@
|
|
21
21
|
}
|
22
22
|
```
|
23
23
|
|
24
|
-
としてみてください。
|
24
|
+
としてみてください。
|
25
|
+
|
26
|
+
---
|
27
|
+
追記: 修正したあとのCSS全文は下記です。
|
28
|
+
(構文エラーが合った部分は、`.top-cate-btn label{`を削除して `.top-cate-btn label:last-of-type{` を残してます)
|
29
|
+
``` css
|
30
|
+
.top-cate-btn{
|
31
|
+
margin: 10px 0 20px;
|
32
|
+
border-radius: 5px;
|
33
|
+
overflow: hidden;
|
34
|
+
display: flex;
|
35
|
+
flex-wrap: wrap;
|
36
|
+
box-shadow: 0 3px 10px -2px rgba(0,0,0,.2);
|
37
|
+
}
|
38
|
+
.top-cate-btn label{
|
39
|
+
width: calc(100% / 4);
|
40
|
+
padding: 10px;
|
41
|
+
text-align: center;
|
42
|
+
background: #eee;
|
43
|
+
transition: .5s;
|
44
|
+
border-right: 1px solid #ddd;
|
45
|
+
}
|
46
|
+
#tab1:checked ~ .top-cate-btn label[for="tab1"],
|
47
|
+
#tab2:checked ~ .top-cate-btn label[for="tab2"],
|
48
|
+
#tab3:checked ~ .top-cate-btn label[for="tab3"],
|
49
|
+
#tab4:checked ~ .top-cate-btn label[for="tab4"],
|
50
|
+
.top-cate-btn label:hover{
|
51
|
+
background: #66cccc
|
52
|
+
}
|
53
|
+
.top-cate-btn label:last-of-type{
|
54
|
+
border-right: none;
|
55
|
+
}
|
56
|
+
.tab-cont,
|
57
|
+
input[name="tab_item"]{
|
58
|
+
display: none;
|
59
|
+
}
|
60
|
+
@keyframes show{
|
61
|
+
from{
|
62
|
+
opacity: 0;
|
63
|
+
}
|
64
|
+
to{
|
65
|
+
opacity: 1;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
#tab1:checked ~ .tab-cont.tb1,
|
69
|
+
#tab2:checked ~ .tab-cont.tb2,
|
70
|
+
#tab3:checked ~ .tab-cont.tb3,
|
71
|
+
#tab4:checked ~ .tab-cont.tb4{
|
72
|
+
display: block;
|
73
|
+
animation: show 1s linear 0s;
|
74
|
+
}
|
75
|
+
/* スマホ用 */
|
76
|
+
@media screen and (max-width: 768px){
|
77
|
+
.top-cate-btn label{
|
78
|
+
width: calc(100% / 2);
|
79
|
+
}
|
80
|
+
.top-cate-btn label:nth-of-type(2){
|
81
|
+
border-right: none;
|
82
|
+
}
|
83
|
+
.top-cate-btn label:nth-last-of-type(n+3){
|
84
|
+
border-bottom: 1px solid #ddd;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
```
|