質問編集履歴

4

文章を修正

2022/02/24 04:08

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -1,8 +1,8 @@
1
- 提示コードですがstyle.cssにメディアクエリを設定してindex.htmlの<headでも設定しているのですが反映されませんこれはなぜでしょうか?
1
+ 提示コードですがstyle.cssにメディアクエリを設定してindex.htmlの<headでも設定しているのですが反映されませんこれはなぜでしょうか?メディアクエリ外すとbody以外の全てが反映されます。
2
+ メディアクエリを外すと中央揃えとボタンの配色等が有効になるためメディアクエリをつけると反映されません。F5キーを押しても中央揃えが右揃えになりません。またbodyのバックグランドカラーも適用されません。
3
+
2
- メディアクエリ外すとbody以外の全が反映されます。
4
+ メディアクエリいる時
3
-
5
+ ![イメージ説明](https://ddjkaamml8q8x.cloudfront.net/questions/2022-02-24/45972bb0-127b-406b-ab6d-5282fc3d606d.png)
4
-
5
-
6
6
 
7
7
  参考サイト: https://www.1000wave.net/9511
8
8
  ##### index.php

3

文章を修正

2022/02/23 08:54

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -1,85 +1,247 @@
1
- 提示コードのcssファイルですが画面が641px以上max-width:1024px以下の時以下のcssを適用するとう処理を書いているのですが適用されませんこれはなぜでしょうか?
1
+ 提示コードですがstyle.cssにメディアクエリ設定しindex.htmlの<headでも設定しているのですが反映されませんこれはなぜでしょうか?
2
- 保存してサーバーにップロードしCtrl + F5を押して更新しているのですなぜか更新されません
2
+ メディクエリ外すとbody以外の全てが反映されま
3
+
4
+
5
+
3
6
 
4
7
  参考サイト: https://www.1000wave.net/9511
5
- 参考サイト: https://shu-sait.com/media-queries-maxwidth-minwidth/
6
-
7
-
8
- ##### html
8
+ ##### index.php
9
9
  ```php
10
10
  <!DOCTYPE html>
11
11
  <html lang=ja>
12
12
  <head>
13
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
13
14
  <meta charset="utf-8">
14
- <meta name="viewport" content="width=device-width,initial-scale=1">
15
15
  <link rel="stylesheet" href="style.css">
16
16
  <title>send</title>
17
- </head>
17
+ </head>
18
+
18
- <body>
19
+ <body>
19
-
20
+
20
- <?php
21
+ <?php
21
- session_cache_limiter('none');
22
+ session_cache_limiter('none');
23
+ session_start();
24
+
25
+ session_regenerate_id(true);
22
- ini_set("display_errors",1);
26
+ ini_set("display_errors",1);
23
- error_reporting(E_ALL);
27
+ error_reporting(E_ALL);
28
+
29
+
24
- session_cache_limiter('none');
30
+ require_once "dataBase.php";
25
- session_start();
31
+ //echo GetUUID()."<br>";
32
+
26
- ?>
33
+ ?>
34
+
35
+
36
+
37
+
27
-
38
+ <!-- ログアウトアイコン -->
28
-
39
+ <?php if(isset($_SESSION['login']) == true)
29
-
40
+ {
41
+ ?>
42
+ <!-- ログイン中 -->
43
+
44
+ <form action="logout.php" method="post">
45
+ <button type="submit"> ログアウト </button>
46
+ </form>
47
+
30
- <form action="updateAsciiArt.php" method="post">
48
+ <form action="newThread.php" method="post">
49
+ <button type="submit"> スレッドを立てる </button>
31
- <p>文章</p>
50
+ </form>
51
+
52
+ <form action="profile.php?ID=<?php echo $_SESSION["id"] ?>" method="post">
32
- <input type="text" class="asciiArt" name="comment" >
53
+ <button type="submit" name="submit"> プロフィール </button>
33
- <br>
54
+ </form>
34
55
 
56
+
57
+ <?php
58
+ }
59
+ ?>
60
+
61
+
62
+
63
+
64
+
65
+
66
+ <div class="searchBar">
67
+ <h1 > 掲示板 </h1>
68
+ <!-- 検索 -->
69
+ <form action="search.php" method="post">
70
+ <input type="search" name="name"><br>
71
+ <button type="submit" name="submit"> 検 索 </button>
72
+ <br>
73
+ </form>
74
+ </div>
75
+ <br>
76
+
77
+ <?php
78
+ try
79
+ {
80
+ $dsn = 'mysql:dbname=Bulletin_Board;host=localhost;charset=utf8';
81
+ $dbh = new PDO($dsn,"root","Shigurechan7240");
82
+ $dbh->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
83
+ $sql = 'SELECT * FROM Thread';
84
+ $stmt = $dbh->prepare($sql);
85
+ $stmt->execute();
86
+ }
87
+ catch(PDOException $e)
88
+ {
89
+ die($e->getMessage());
90
+ }
91
+
92
+
93
+ ?>
94
+
95
+
96
+ <?php if(isset($_SESSION['login']) == false)
97
+ {
98
+ ?>
99
+ <form class="center" action="register.php" method="post">
100
+ <button type="submit"> 登録 </button>
35
101
  </form>
36
102
 
103
+ <form class="center" action="login.php" method="post">
104
+ <button type="submit"> ログイン </button>
105
+ </form>
106
+ <?php
107
+ }
108
+
109
+ try
110
+ {
111
+ $dsn = 'mysql:dbname=Bulletin_Board;host=localhost;charset=utf8';
112
+ $dbh = new PDO($dsn,"root","Shigurechan7240");
113
+ $dbh->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
114
+ $sql = 'SELECT * FROM Thread WHERE `enable`=true ORDER BY post_count DESC';
115
+ $stmt = $dbh->prepare($sql);
116
+ $stmt->execute();
117
+ $result = $stmt->fetchAll();
118
+ }
119
+ catch(PDOException $e)
120
+ {
121
+ die($e->getMessage());
122
+ }
123
+ ?>
124
+
125
+ <div class="threadList">
126
+ <?php
127
+ for($i = 0; $i < $stmt->rowCount(); $i++)
128
+ {
129
+ ?>
130
+
131
+ <!-- 人気スレッドを表示 -->
132
+ <a href="thread.php?title=<?php echo $result[$i]["ID"] ?>"> <?php echo $result[$i]["name"] ?> </a>
133
+
134
+ <?php
135
+ if($i == 20)
136
+ {
137
+ ?>
138
+
139
+ <h1> これ以上表示出来ません検索を利用してください。 </h1>
140
+
141
+ <?php
142
+ break;
143
+ }
144
+ }
145
+ ?>
146
+ </div>
147
+
148
+
149
+
37
- </body>
150
+ </body>
151
+
38
152
  </html>
153
+
39
154
  ```
40
155
 
156
+
41
- #####css
157
+ ##### style.css
42
158
  ```css
43
- @media screen and (min-width:641px) and ( max-width:1024px)
159
+ @media screen and(min-width: 641px)
44
- {
160
+ {
45
- p
161
+
46
- {
162
+
47
- color: #C0C0C0;
48
-
49
- }
50
-
51
- .center
163
+ .threadList
52
164
  {
53
165
  text-align: center;
166
+
54
- }
167
+ }
168
+
169
+
55
-
170
+ .p
171
+ {
172
+ color: #C0C0C0;
173
+ font-size: 20px;
174
+
175
+ }
176
+
177
+ .p_rightButon
178
+ {
179
+ display: inline;
180
+ }
181
+
182
+ .form
183
+ {
184
+ white-space: nowrap;
185
+ display: inline;
186
+ }
187
+
188
+ .searchBar
189
+ {
190
+ text-align: center;
191
+ }
192
+
193
+
56
- button.right
194
+ .button.right
57
195
  {
58
196
  text-align: right;
59
197
  }
60
198
 
199
+
61
- h4
200
+ .h6
62
201
  {
63
202
  color: #C0C0C0;
64
203
  }
65
204
 
205
+
66
- h3
206
+ .h5
67
- {
68
- color: #C0C0C0;
69
-
70
- }
71
-
72
-
73
- h1
74
207
  {
75
208
  color: #C0C0C0;
76
209
  }
77
210
 
78
-
211
+ .h4
212
+ {
213
+ color: #C0C0C0;
214
+ }
215
+
216
+ .h3
217
+ {
218
+ color: #C0C0C0;
219
+
220
+ }
221
+
222
+ .h2
223
+ {
224
+ color: #C0C0C0;
225
+
226
+ }
227
+
228
+ .h1
229
+ {
230
+ color: #C0C0C0;
231
+
232
+ }
233
+
234
+ .threadTopBar
235
+ {
236
+
237
+ color: #C0C0C0;
238
+ text-align: center;
239
+ }
79
240
 
80
241
  a
81
242
  {
82
243
  text-decoration: none;
244
+ font-size: 20px;
83
245
  color: #2096F3;
84
246
  }
85
247
 
@@ -89,9 +251,10 @@
89
251
  }
90
252
 
91
253
 
92
- input[type=button]
254
+ .input[type=button]
93
- {
255
+ {
94
-
256
+
257
+
95
258
 
96
259
  width:100px;
97
260
  background-color:#2096F3;
@@ -109,28 +272,32 @@
109
272
  }
110
273
 
111
274
  /* アスキーアート入力フォーム */
112
- .asciiArt
275
+ textarea.asciiArt
113
- {
276
+ {
277
+ resize: none;
114
- width:60px;
278
+ width: 100%;
115
279
  }
116
280
 
117
281
 
118
282
  button
119
283
  {
120
-
284
+
121
285
  height:30px;
122
286
  width: 150px;
123
287
  background-color:#2096F3;
124
288
  color:#fff;
289
+ display: inline-block;
125
290
 
126
291
  border-radius: 3px;
127
292
  box-shadow: 0 0 8px rgba(0,0,0,0.4);
128
293
  }
129
294
 
130
295
 
296
+
131
297
  .deleteButton
132
298
  {
299
+
133
-
300
+ display: inline-block;
134
301
  height:30px;
135
302
  width: 60px;
136
303
  background-color:#FF0000;
@@ -140,140 +307,48 @@
140
307
  box-shadow: 0 0 8px rgba(0,0,0,0.4);
141
308
  }
142
309
 
310
+ .postSelect
311
+ {
312
+ display:inline-block;
313
+ }
314
+
143
315
  .goodButton
144
316
  {
145
-
317
+ text-align: left;
318
+ display:inline-block;
319
+
146
320
  height:30px;
147
321
  width: 100px;
148
322
  background-color:#FFFF00;
149
323
  color:#000000;
150
324
 
151
- border-radius: 20px;
325
+
152
- box-shadow: 0 0 1px #CCCC00;
153
- }
326
+ }
154
-
155
-
156
-
157
-
327
+
328
+
329
+
158
- body
330
+ .goodButtonThread
159
- {
331
+ {
160
- background-color: #15202B;
161
-
162
-
163
- }
164
-
165
- }
166
-
167
- @media screen and(max-width: 640px)
168
- {
169
- p
170
- {
171
- color: #C0C0C0;
172
-
173
- }
174
-
175
- .center
176
- {
177
- text-align: center;
332
+ text-align: left;
178
- }
333
+
179
-
180
- button.right
181
- {
182
- text-align: right;
183
- }
184
-
185
- h4
186
- {
187
- color: #C0C0C0;
188
- }
189
-
190
- h3
191
- {
192
- color: #C0C0C0;
193
-
194
- }
195
-
196
-
197
- h1
198
- {
199
- color: #C0C0C0;
200
- }
201
-
202
-
203
-
204
- a
205
- {
206
- text-decoration: none;
207
- color: #2096F3;
208
- }
209
-
210
- a:hover
211
- {
212
- text-decoration: underline;
213
- }
214
-
215
-
216
- input[type=button]
217
- {
218
-
219
-
220
- width:100px;
221
- background-color:#2096F3;
222
- color:#fff;
223
- padding: 15px;
224
- border-radius: 3px;
225
- box-shadow: 0 0 8px rgba(0,0,0,0.4);
226
-
227
- }
228
-
229
- textarea
230
- {
231
-
232
- height:100px;
233
- }
234
-
235
- button
236
- {
237
-
238
- height:30px;
239
- width: 150px;
240
- background-color:#2096F3;
241
- color:#fff;
242
-
243
- border-radius: 3px;
244
- box-shadow: 0 0 8px rgba(0,0,0,0.4);
245
- }
246
-
247
- .deleteButton
248
- {
249
-
250
- height:30px;
251
- width: 60px;
252
- background-color:#FF0000;
253
- color:#fff;
254
-
255
- border-radius: 3px;
256
- box-shadow: 0 0 8px rgba(0,0,0,0.4);
257
- }
258
-
259
- .goodButton
260
- {
261
-
262
334
  height:30px;
263
335
  width: 100px;
264
336
  background-color:#FFFF00;
265
337
  color:#000000;
266
338
 
267
- border-radius: 20px;
339
+
268
- box-shadow: 0 0 1px #CCCC00;
269
- }
340
+ }
341
+
270
-
342
+ .searchBar
343
+ {
344
+ text-align: center;
345
+ }
346
+
271
- body
347
+ .body
272
348
  {
273
349
  background-color: #15202B;
274
350
 
275
351
 
276
352
  }
277
- }
353
+ }
278
-
279
354
  ```

2

タイトルを修正

2022/02/20 10:15

投稿

退会済みユーザー
test CHANGED
@@ -1 +1 @@
1
- html css <meta name="viewport" タグ効かない原因が知りたい。
1
+ html css @media screen反映されない原因が知りたい。
test CHANGED
File without changes

1

文章を修正

2022/02/19 03:33

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,5 @@
1
1
  提示コードのcssファイルですが画面が641px以上max-width:1024px以下の時以下のcssを適用するとう処理を書いているのですが適用されません。これはなぜでしょうか?
2
+ 保存してサーバーにアップロードしてCtrl + F5を押して更新しているのですがなぜか更新されません。
2
3
 
3
4
  参考サイト: https://www.1000wave.net/9511
4
5
  参考サイト: https://shu-sait.com/media-queries-maxwidth-minwidth/