質問編集履歴

1

コードを追加

2022/04/01 01:12

投稿

suzu1234
suzu1234

スコア41

test CHANGED
File without changes
test CHANGED
@@ -1,3 +1,287 @@
1
1
  一度レスポンシブデザインを反映してみると横スクロールが出ずにちゃんと反映されるのですが、F12を押してpc表示にし、再度F12を押すと横スクロールが表示されてしまいます。
2
2
 
3
3
  F12で解除する前は横スクロールが出ないのに一度解除すると横スクロールが出てしまう原因が分かりません。各要素を確認してみてもレスポンシブに指定した幅を超えていないので原因が全く分かりません。
4
+
5
+ 模写コーディングさせてもらっているページです
6
+ https://code-step.com/demo/html/ec/
7
+
8
+ ```ここに言語を入力
9
+ <header>
10
+ <div class="container header">
11
+ <h1><a href="#"><img class="header-icon" src="https://code-step.com/demo/html/ec/img/logo.svg"></a></h1>
12
+ <div class="header-list">
13
+ <ul class="left-list">
14
+ <li><a href="#">ALL</a></li>
15
+ <li><a href="#">NEW</a></li>
16
+ <li><a href="#">VINTAGE</a></li>
17
+ <li><a href="#">CATEGORY</a></li>
18
+ <li><a href="#">LOOKBOOK</a></li>
19
+ <li><a href="#">BLOG</a></li>
20
+ </ul>
21
+ <ul class="right-list">
22
+ <li><a href="#">LOGIN</a></li>
23
+ <li><a href="#">CONTACT</a></li>
24
+ </ul>
25
+ </div>
26
+ </div>
27
+ </header>
28
+
29
+ <div class="container main">
30
+ <img class="main-image" src="https://code-step.com/demo/html/ec/img/item.jpg">
31
+
32
+ <div class="main-text">
33
+ <h2>TOTALLY Short Sleeve Shirt</h2>
34
+ <p class="text">
35
+ テキストテキストテキストテキストテキストテキストテキスト<br/>
36
+ テキストテキストテキストテキストテキストテキストテキスト<br/>
37
+ テキストテキストテキストテキストテキストテキストテキスト<br/>
38
+ テキストテキストテキストテキストテキストテキストテキスト<br/>
39
+ テキストテキストテキストテキストテキストテキストテキスト<br/>
40
+ テキストテキストテキスト
41
+ </p>
42
+
43
+ <p class="price">¥9,999 +tax</p>
44
+ <!----------------------------------------------------------------------------->
45
+ <table class="firsttable">
46
+ <tr>
47
+ <th class="color">Color</th>
48
+ <th class="size">Size</th>
49
+ <th class="kuurann"></th>
50
+ </tr>
51
+ <tr>
52
+ <td>White</td>
53
+ <td>S</td>
54
+ <td>
55
+ <select name="quantity">
56
+ <option value="1">1</option>
57
+ <option value="2">2</option>
58
+ <option value="3">3</option>
59
+ </select>
60
+ </td>
61
+ </tr>
62
+ <tr>
63
+ <td>White</td>
64
+ <td>M</td>
65
+ <td>
66
+ <select name="quantity">
67
+ <option value="1">1</option>
68
+ <option value="2">2</option>
69
+ <option value="3">3</option>
70
+ </select>
71
+ </td>
72
+ </tr>
73
+ <tr>
74
+ <td>White</td>
75
+ <td>L</td>
76
+ <td>
77
+ <select name="quantity">
78
+ <option value="1">1</option>
79
+ <option value="2">2</option>
80
+ <option value="3">3</option>
81
+ </select>
82
+ </td>
83
+ </tr>
84
+ </table>
85
+
86
+ <a class="add-to-cart" href="#">ADD TO CART</a>
87
+ <!----------------------------------------------------------------------------->
88
+ <table class="secondtable" border="1">
89
+ <tr>
90
+ <th>Size</th>
91
+ <th>Chest</th>
92
+ <th>Weist</th>
93
+ <th>Height</th>
94
+ </tr>
95
+ <tr>
96
+ <td class="s">S</td>
97
+ <td>99~99</td>
98
+ <td>99~99</td>
99
+ <td>99~99</td>
100
+ </tr>
101
+ <tr>
102
+ <td class="m">M</td>
103
+ <td>99~99</td>
104
+ <td>99~99</td>
105
+ <td>99~99</td>
106
+ </tr>
107
+ <tr>
108
+ <td class="l">L</td>
109
+ <td>99~99</td>
110
+ <td>99~99</td>
111
+ <td>99~99</td>
112
+ </tr>
113
+ </table>
114
+ </div>
115
+ </div>
116
+
117
+ <footer>
118
+ <div class="container footer">
119
+ <p>© TOTALLY</p>
120
+ </div>
121
+ </footer>
122
+
123
+ </body>
124
+ ```
125
+
126
+ ```ここに言語を入力
127
+ html {
128
+ font-size: 100%;
129
+ font-size: 12px;
130
+ }
131
+
132
+ img {
133
+ width: 100%;
134
+ }
135
+
136
+ * {
137
+ box-sizing: border-box;
138
+ /*outline: 1px solid magenta;*/
139
+ }
140
+
141
+ body {
142
+ margin: 0;
143
+ padding: 0;
144
+ }
145
+
146
+ li {
147
+ list-style: none;
148
+ }
149
+
150
+ a {
151
+ text-decoration: none;
152
+ color: black;
153
+ }
154
+
155
+ /*----------------------------------------------------------------------------*/
156
+ .container {
157
+ background-color: pink;
158
+ max-width: 1000px;
159
+ width: 100%;
160
+ margin: 0 auto;
161
+ margin-top: 40px;
162
+ padding: 0 6.5%;
163
+ }
164
+
165
+ .header {
166
+ text-align: center;
167
+ border-bottom: 1px solid black;
168
+ }
169
+
170
+ .header-list {
171
+ display: flex;
172
+ justify-content: space-between;
173
+ }
174
+
175
+ .header-list ul {
176
+ display: flex;
177
+ padding-left: 0;
178
+ margin-top: 0;
179
+ }
180
+
181
+ .header-list li:last-child {
182
+ margin-right: 0;
183
+ }
184
+
185
+ .left-list li {
186
+ margin-right: 15px;
187
+ }
188
+
189
+ .right-list li {
190
+ margin-right: 15px;
191
+ }
192
+
193
+ .header img {
194
+ width: 110px;
195
+ }
196
+ /*----------------------------------------------------------------------------*/
197
+ .main {
198
+ display: flex;
199
+ justify-content: space-between;
200
+ margin-top: 70px;
201
+ }
202
+
203
+ .main-image {
204
+ width: 50%;
205
+ height: 500px;
206
+ }
207
+
208
+ .main-text h2 {
209
+ margin: 0 0 23px 0;
210
+ border-top: 1px solid black;
211
+ border-bottom: 1px solid black;
212
+ padding: 15px 0;
213
+ font-size: 15px;
214
+ }
215
+
216
+ .main-text .text {
217
+ line-height: 23px;
218
+ }
219
+
220
+ .main-text .price {
221
+ margin: 35px 0px;
222
+ }
223
+ /*----------------------------------------------------------------------------*/
224
+ .add-to-cart {
225
+ color: white;
226
+ background-color: #333333;
227
+ display: block;
228
+ text-align: center;
229
+ padding: 15px 70px;
230
+ margin: 20px 0 30px 0px;
231
+ }
232
+ /*---------------------------------------------------------*/
233
+ .firsttable {
234
+ text-align: center;
235
+ width: 100%;
236
+ height: 150px;
237
+ }
238
+
239
+ .color, .size {
240
+ width: 20%;
241
+ }
242
+
243
+ .kuurann {
244
+ width: 60%;
245
+ }
246
+
247
+ .firsttable td {
248
+ border-top: 1px solid black;
249
+ }
250
+
251
+ .firsttable th, td {
252
+ border-right: 1px solid black;
253
+ font-weight: normal;
254
+ }
255
+
256
+ .firsttable th:last-child, td:last-child {
257
+ border-right: none;
258
+ }
259
+
260
+ select {
261
+ width: 90%;
262
+ }
263
+
264
+ /*----------------------------------------------------------*/
265
+ .secondtable {
266
+ width: 100%;
267
+ height: 150px;
268
+ text-align: center;
269
+ }
270
+
271
+ .secondtable th {
272
+ font-weight: normal;
273
+ background-color: #CCCCCC;
274
+ }
275
+
276
+ .s, .m, .l {
277
+ background-color: #CCCCCC;
278
+ }
279
+
280
+
281
+ /*----------------------------------------------------------------------------*/
282
+ footer {
283
+ text-align: center;
284
+ color: #808080;
285
+ font-size: 6px;
286
+ }
287
+ ```