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

質問編集履歴

4

文章を修正

2022/02/24 04:08

投稿

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

3

文章を修正

2022/02/23 08:54

投稿

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

2

タイトルを修正

2022/02/20 10:15

投稿

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

1

文章を修正

2022/02/19 03:33

投稿

退会済みユーザー
title CHANGED
File without changes
body 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/