teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

css追加

2020/05/12 23:59

投稿

d-1477
d-1477

スコア1

title CHANGED
File without changes
body CHANGED
@@ -133,29 +133,65 @@
133
133
  どなたかご教授いただける方がおりましたら
134
134
  宜しくお願い致します。
135
135
 
136
+
137
+ --- タブ切り替えCSS ---
136
138
  ```ここに言語を入力
137
- <div class="tabs">
139
+ /*タブ切り替え全体のスタイル*/
138
- <input id="onsen" type="radio" name="tab_item" checked>
140
+ .tabs {
139
- <label class="tab_item" for="onsen">温泉</label>
141
+ margin-top: 50px;
140
- <input id="kankou" type="radio" name="tab_item">
142
+ padding-bottom: 40px;
141
- <label class="tab_item" for="kankou">観光</label>
142
- <input id="resort" type="radio" name="tab_item">
143
- <label class="tab_item" for="resort">ビーチ & リゾート</label>
144
- <input id="gurmet" type="radio" name="tab_item">
145
- <label class="tab_item" for="gurmet">グルメ</label>
143
+ background-color: #282F39;
146
- <input id="family" type="radio" name="tab_item">
144
+ width: 100%;
147
- <label class="tab_item" for="family">ファミリー</label>
148
- <input id="group" type="radio" name="tab_item">
145
+ margin: 0 auto;}
149
- <label class="tab_item" for="group">団体 & MICE</label>
150
146
 
147
+ /*タブのスタイル*/
148
+ .tab_item {
149
+ width: calc(100%/6);
150
+ height: 80px;
151
+ border-bottom: 3px solid #282F39;
152
+ background-color: #ECECEC;
153
+ line-height: 50px;
154
+ font-size: 20px;
151
- <!-- 温泉 -->
155
+ text-align: center;
152
- <div class="tab_content" id="onsen_content">
153
- <div class="tab_content_description">
156
+ display: block;
154
- <div>
157
+ float: left;
158
+ text-align: center;
159
+ font-weight: bold;
160
+ transition: all 0.2s ease;
161
+ color: #282F39;
162
+ padding-top: 15px;
163
+ }
164
+ .tab_item:hover {
165
+ opacity: 0.75;
166
+ }
155
167
 
156
- <p class="title_sub fff">ONSEN</p>
157
- <h2 class="fff">温泉</h2>
168
+ /*ラジオボタンを全て消す*/
158
- <div class="experience_base">
169
+ input[name="tab_item"] {
170
+ display: none;
171
+ }
172
+
159
- <h3>国内</h3>
173
+ /*タブ切り替えの中身のスタイル*/
174
+ .tab_content {
175
+ display: none;
176
+ padding: 40px 0 0;
177
+ clear: both;
160
- </div>
178
+ overflow: hidden;
179
+ }
180
+
181
+
182
+ /*選択されているタブのコンテンツのみを表示*/
183
+ #onsen:checked ~ #onsen_content,
184
+ #kankou:checked ~ #kankou_content,
185
+ #resort:checked ~ #resort_content,
186
+ #gurmet:checked ~ #gurmet_content,
187
+ #family:checked ~ #family_content,
188
+ #group:checked ~ #group_content {
189
+ display: block;
190
+ }
191
+
192
+ /*選択されているタブのスタイルを変える*/
193
+ .tabs input:checked + .tab_item {
194
+ background-color: #282F39;
195
+ color: #fff;
196
+ }
161
197
  ```

2

コード追記

2020/05/12 23:59

投稿

d-1477
d-1477

スコア1

title CHANGED
File without changes
body CHANGED
@@ -131,4 +131,31 @@
131
131
 
132
132
  初歩的な質問で大変申し訳ございません。
133
133
  どなたかご教授いただける方がおりましたら
134
- 宜しくお願い致します。
134
+ 宜しくお願い致します。
135
+
136
+ ```ここに言語を入力
137
+ <div class="tabs">
138
+ <input id="onsen" type="radio" name="tab_item" checked>
139
+ <label class="tab_item" for="onsen">温泉</label>
140
+ <input id="kankou" type="radio" name="tab_item">
141
+ <label class="tab_item" for="kankou">観光</label>
142
+ <input id="resort" type="radio" name="tab_item">
143
+ <label class="tab_item" for="resort">ビーチ & リゾート</label>
144
+ <input id="gurmet" type="radio" name="tab_item">
145
+ <label class="tab_item" for="gurmet">グルメ</label>
146
+ <input id="family" type="radio" name="tab_item">
147
+ <label class="tab_item" for="family">ファミリー</label>
148
+ <input id="group" type="radio" name="tab_item">
149
+ <label class="tab_item" for="group">団体 & MICE</label>
150
+
151
+ <!-- 温泉 -->
152
+ <div class="tab_content" id="onsen_content">
153
+ <div class="tab_content_description">
154
+ <div>
155
+
156
+ <p class="title_sub fff">ONSEN</p>
157
+ <h2 class="fff">温泉</h2>
158
+ <div class="experience_base">
159
+ <h3>国内</h3>
160
+ </div>
161
+ ```

1

タグ付けの誤り修正

2020/05/12 08:30

投稿

d-1477
d-1477

スコア1

title CHANGED
File without changes
body CHANGED
@@ -1,4 +1,4 @@
1
- 不動産内製化で制作の為、JavaScriptの知識がなく
1
+ 不動産内製化で制作の為、WEB制作の知識がなく
2
2
  ご教授いただきたく存じます。
3
3
 
4
4
  ページ遷移後に任意のタブを開いた状態で表示させたいと思っております。