質問編集履歴

2

頂いたコードを編集して(be_img)、背景画像が画面サイズで表示されるように加工しています。

2019/07/08 07:45

投稿

neison
neison

スコア13

test CHANGED
File without changes
test CHANGED
@@ -1,60 +1,88 @@
1
1
  ```html
2
2
 
3
+ html
4
+
3
5
  css (CSSのファイルは全て同一)
4
6
 
5
- .bg_img{
6
-
7
- background: url(doraemon_background_1.png);
8
-
9
- wight: cover;
10
-
11
- height: cover;
12
-
13
- background-size:cover;
14
-
15
- background-position:cover;
16
-
17
- position: relative;
18
-
19
- }
20
-
21
- .bg_img::after {
22
-
23
- content: '';
24
-
25
- background-color: rgba(255,255,255,.5);
26
-
27
- position: relative;
28
-
29
- margin:auto;
30
-
31
- height: cover;
32
-
33
- }
34
-
35
- .sample{
36
-
37
- position: relative;
38
-
39
- margin-right: auto;
40
-
41
- margin-left : auto;
42
-
43
- text-align: center;
44
-
45
- font-size:3.0rem;
46
-
47
- color: #FFF;
48
-
49
- font-weight: bold;
50
-
51
- z-index: 10;
52
-
53
-
54
-
55
- }
56
-
57
-
7
+ * {
8
+
9
+ padding: 0;
10
+
11
+ margin: 0;
12
+
13
+ }
14
+
15
+
16
+
17
+ html,
18
+
19
+ body {
20
+
21
+ width: 100%;
22
+
23
+ height:100%;
24
+
25
+ }
26
+
27
+
28
+
29
+ .bg_img {//背景画像にpc画面いっぱいに表示して固定・no repeatの機能を追加しています。
30
+
31
+ background: url("doraemon_background_1.png");
32
+
33
+ background-size: cover;
34
+
35
+ height: 100vh;
36
+
37
+ background-attachment: fixed;
38
+
39
+ }
40
+
41
+
42
+
43
+ .sample {
44
+
45
+ background-color: rgba(255, 255, 255, 0.5);
46
+
47
+ height: 100%;
48
+
49
+ width: 50%; /* 透かしにする背景色の横の長さはここで調整 */
50
+
51
+ margin: 0 auto;
52
+
53
+ animation: change-bgcolor 60s cubic-bezier(0, 1, 0, 1) infinite;
54
+
55
+ }
56
+
57
+
58
+
59
+ @keyframes change-bgcolor {
60
+
61
+ 25% {
62
+
63
+ background-color: rgba(255, 255, 255, 0.5);
64
+
65
+ }
66
+
67
+ 50% {
68
+
69
+ background-color: rgba(255, 0, 0, 0.5);
70
+
71
+ }
72
+
73
+ 75% {
74
+
75
+ background-color: rgba(0, 255, 0, 0.5);
76
+
77
+ }
78
+
79
+ 100% {
80
+
81
+ background-color: rgba(0, 0, 255, 0.5);
82
+
83
+ }
84
+
85
+ }
58
86
 
59
87
 
60
88
 

1

コードをマークダウンの機能で追加しました。

2019/07/08 07:45

投稿

neison
neison

スコア13

test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,228 @@
1
+ ```html
2
+
3
+ css (CSSのファイルは全て同一)
4
+
5
+ .bg_img{
6
+
7
+ background: url(doraemon_background_1.png);
8
+
9
+ wight: cover;
10
+
1
- ### 前提・実現したいこと
11
+ height: cover;
12
+
13
+ background-size:cover;
14
+
15
+ background-position:cover;
16
+
17
+ position: relative;
18
+
19
+ }
20
+
21
+ .bg_img::after {
22
+
23
+ content: '';
24
+
25
+ background-color: rgba(255,255,255,.5);
26
+
27
+ position: relative;
28
+
29
+ margin:auto;
30
+
31
+ height: cover;
32
+
33
+ }
34
+
35
+ .sample{
36
+
37
+ position: relative;
38
+
39
+ margin-right: auto;
40
+
41
+ margin-left : auto;
42
+
43
+ text-align: center;
44
+
45
+ font-size:3.0rem;
46
+
47
+ color: #FFF;
48
+
49
+ font-weight: bold;
50
+
51
+ z-index: 10;
52
+
53
+
54
+
55
+ }
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+ html
64
+
65
+
66
+
67
+
68
+
69
+ <body>
70
+
71
+
72
+
73
+
74
+
75
+ <script>
76
+
77
+ MQTTconnect();
78
+
79
+ </script>
80
+
81
+ <div class="bg_img">
82
+
83
+ <div class="bg_img::after">
84
+
85
+ <div class="sample">
86
+
87
+ <h2> タイトル</h2>
88
+
89
+
90
+
91
+ <p>
92
+
93
+ 現在の時刻: {{now}}
94
+
95
+ </p>
96
+
97
+ CloudMQTT 接続 Status: <div id="status">Connection Status: Not Connected</div>
98
+
99
+ <br>
100
+
101
+
102
+
103
+
104
+
105
+ <h2 id="example2">  </h2>
106
+
107
+ <figure>
108
+
109
+ <p><img id="a_signal" src="写真" WIDTH = "700px" HEIGHTl = "500px"></p>
110
+
111
+ </figure>
112
+
113
+ <br>
114
+
115
+ <h2 id="example2">  </h2>
116
+
117
+ <font size = "7" color="#F00">文字</font>
118
+
119
+ <br>
120
+
121
+
122
+
123
+ <p><a href="#example"><font size = "6">↓↓↓文字↓↓↓</font></a></p>
124
+
125
+
126
+
127
+ <p>
128
+
129
+ <div style="margin-bottom:1000px"></div><font size = "6" color="#000"></font>
130
+
131
+ </p>
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+ <h2 id="example">  </h2>
142
+
143
+ 文字:<p id="messages"></p>
144
+
145
+ <figure>
146
+
147
+ <img id="trafic_signal" src="写真" WIDTH = "700px" HEIGHTl = "500px">
148
+
149
+ </figure>
150
+
151
+ <br>
152
+
153
+
154
+
155
+ <p>
156
+
157
+ <input type="button" value="文字" onclick="clickBtn(&quot;BLUE&quot;)" style="font-size:28px; color:#ffffff;background-color:#4EE27F;WIDTH:350px; HEIGHT:80px;"/>
158
+
159
+ <input type="button" value="文字" onclick="clickBtn(&quot;RED&quot;)" style="font-size:28px; color:#000000;background-color:#FF0000;WIDTH:350px; HEIGHT:80px;"/><br>
160
+
161
+ <input type="button" value="文字" onclick="clickBtn(&quot;YELLOW&quot;)" style="font-size:28px; color:#000000;background-color:#FFFF00;WIDTH:700px; HEIGHT:80px;"/>
162
+
163
+ <p><font size = "6">文字</font></p>
164
+
165
+ <input type="button" value="文字" onclick="clickBtn3(&quot;A&quot;)" style="font-size:24px; color:#ffffff;background-color:#000000;WIDTH:96px; HEIGHT:72px;"/>
166
+
167
+ <input type="button" value="文字" onclick="clickBtn3(&quot;B&quot;)" style="font-size:24px; color:#000000;background-color:#ffffff;WIDTH:96px; HEIGHT:72px;"/>
168
+
169
+ <input type="button" value="文字" onclick="clickBtn3(&quot;C&quot;)" style="font-size:24px; color:#ffffff;background-color:#000000;WIDTH:96px; HEIGHT:72px;"/>
170
+
171
+ <input type="button" value="文字" onclick="clickBtn3(&quot;D&quot;)" style="font-size:24px; color:#000000;background-color:#ffffff;WIDTH:96px; HEIGHT:72px;"/>
172
+
173
+ <input type="button" value="文字" onclick="clickBtn3(&quot;E&quot;)" style="font-size:24px; color:#ffffff;background-color:#000000;WIDTH:96px; HEIGHT:72px;"/>
174
+
175
+ <input type="button" value="文字" onclick="clickBtn3(&quot;F&quot;)" style="font-size:24px; color:#000000;background-color:#ffffff;WIDTH:96px; HEIGHT:72px;"/>
176
+
177
+ </p>
178
+
179
+
180
+
181
+
182
+
183
+ <p>
184
+
185
+ <div style="margin-bottom:2000px"></div>
186
+
187
+ </p>
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+ <figure>
200
+
201
+ <legend> 文字 </legend>
202
+
203
+ <img id="c_signal" src="写真" WIDTH = "700px" HEIGHTl = "500px">
204
+
205
+ </figure>
206
+
207
+ <br>
208
+
209
+ <input type="button" value="文字" onclick="clickBtn(&quot;RED&quot;)" style="font-size:28px; color:#000000;background-color:#FFFF00;WIDTH:700px; HEIGHT:80px;"/>
210
+
211
+
212
+
213
+ <p><a href="#example2"><font size = "6">↑↑↑一番上に戻る↑↑↑</font></a></p>
214
+
215
+ </div>
216
+
217
+ </div>
218
+
219
+ </div>
220
+
221
+ <!--</div>
222
+
223
+ </div>-->
224
+
225
+ ```
2
226
 
3
227
 
4
228
 
@@ -54,98 +278,6 @@
54
278
 
55
279
  ### 該当のソースコード
56
280
 
57
- css (ファイル)
58
-
59
- .bg_img{
60
-
61
- background: url(doraemon_background_1.png);
62
-
63
- wight: cover;
64
-
65
- height: cover;
66
-
67
- background-size:cover;
68
-
69
- background-position:cover;
70
-
71
- position: relative;
72
-
73
- }
74
-
75
- .bg_img::after {
76
-
77
- content: '';
78
-
79
- background-color: rgba(255,255,255,.5);
80
-
81
- position: relative;
82
-
83
- margin:auto;
84
-
85
- height: cover;
86
-
87
- }
88
-
89
- .sample{
90
-
91
- position: relative;
92
-
93
- margin-right: auto;
94
-
95
- margin-left : auto;
96
-
97
- text-align: center;
98
-
99
- font-size:3.0rem;
100
-
101
- color: #FFF;
102
-
103
- font-weight: bold;
104
-
105
- z-index: 10;
106
-
107
-
108
-
109
- }
110
-
111
-
112
-
113
-
114
-
115
-
116
-
117
- html
118
-
119
- <body>
120
-
121
-
122
-
123
-
124
-
125
- <script>
126
-
127
- MQTTconnect();
128
-
129
- </script>
130
-
131
- <div class="bg_img">
132
-
133
- <div class="sample">
134
-
135
-
136
-
137
- コンテンツの中身
138
-
139
-
140
-
141
- </div>
142
-
143
- </div>
144
-
145
-
146
-
147
- </body>
148
-
149
281
 
150
282
 
151
283