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

回答編集履歴

4

修正

2019/07/09 05:49

投稿

Lhankor_Mhy
Lhankor_Mhy

スコア37511

answer CHANGED
@@ -100,7 +100,6 @@
100
100
  width: 50%; /* 透かしにする背景色の横の長さはここで調整 */
101
101
  margin: 0 auto;
102
102
  animation: change-bgcolor 60s cubic-bezier(0, 1, 0, 1) infinite;
103
- position: absolute;
104
103
  }
105
104
 
106
105
  @keyframes change-bgcolor {

3

修正

2019/07/09 05:49

投稿

Lhankor_Mhy
Lhankor_Mhy

スコア37511

answer CHANGED
@@ -88,10 +88,10 @@
88
88
  }
89
89
 
90
90
  @keyframes bgAnime {
91
- 0% { background-image : url("http://placehold.jp/150x150.png?text=doraemon_background_1.png"); }
91
+ 0% { background-image : url("doraemon_background_1.png"); }
92
- 25% { background-image : url("http://placehold.jp/150x150.png?text=doraemon_kabegami1.png"); }
92
+ 25% { background-image : url("doraemon_kabegami1.png"); }
93
- 50% { background-image : url("http://placehold.jp/150x150.png?text=doraemon_background_2.png"); }
93
+ 50% { background-image : url("doraemon_background_2.png"); }
94
- 75% { background-image : url("http://placehold.jp/150x150.png?text=doraemon_kabegami1.png"); }
94
+ 75% { background-image : url("doraemon_kabegami1.png"); }
95
95
  }
96
96
 
97
97
  .sample {

2

質問編集にあわせて追記

2019/07/09 05:37

投稿

Lhankor_Mhy
Lhankor_Mhy

スコア37511

answer CHANGED
@@ -53,4 +53,68 @@
53
53
  background-image : url("doraemon_kabegami1.png"); /* 背景の画像を指定 */
54
54
  animation-delay : 30s;
55
55
  }
56
- ```
56
+ ```
57
+
58
+ ### 質問編集にあわせて追記
59
+ ```html
60
+ <div class="bg_img">
61
+ <div class="sample">
62
+
63
+
64
+ -テキスト・画像
65
+
66
+ </div>
67
+ </div>
68
+ ```
69
+ ```css
70
+ * {
71
+ padding: 0;
72
+ margin: 0;
73
+ }
74
+
75
+ html,
76
+ body {
77
+ width: 100%;
78
+ height:300%;
79
+ }
80
+
81
+ .bg_img {
82
+ background-image : url("http://placehold.jp/150x150.png?text=doraemon_background_1.png");
83
+ background-size: cover;
84
+ min-height: 300%;
85
+ background-attachment: fixed;
86
+ overflow : hidden;
87
+ animation : bgAnime 40s infinite;
88
+ }
89
+
90
+ @keyframes bgAnime {
91
+ 0% { background-image : url("http://placehold.jp/150x150.png?text=doraemon_background_1.png"); }
92
+ 25% { background-image : url("http://placehold.jp/150x150.png?text=doraemon_kabegami1.png"); }
93
+ 50% { background-image : url("http://placehold.jp/150x150.png?text=doraemon_background_2.png"); }
94
+ 75% { background-image : url("http://placehold.jp/150x150.png?text=doraemon_kabegami1.png"); }
95
+ }
96
+
97
+ .sample {
98
+ background-color: rgba(255, 255, 255, 0.5);
99
+ height: 100%;
100
+ width: 50%; /* 透かしにする背景色の横の長さはここで調整 */
101
+ margin: 0 auto;
102
+ animation: change-bgcolor 60s cubic-bezier(0, 1, 0, 1) infinite;
103
+ position: absolute;
104
+ }
105
+
106
+ @keyframes change-bgcolor {
107
+ 25% {
108
+ background-color: rgba(255, 255, 255, 0.5);
109
+ }
110
+ 50% {
111
+ background-color: rgba(255, 0, 0, 0.5);
112
+ }
113
+ 75% {
114
+ background-color: rgba(0, 255, 0, 0.5);
115
+ }
116
+ 100% {
117
+ background-color: rgba(0, 0, 255, 0.5);
118
+ }
119
+ ```
120
+ もしかして、こういうことでしょうか? `.bg_img .hat`はいらない……?

1

訂正

2019/07/09 05:17

投稿

Lhankor_Mhy
Lhankor_Mhy

スコア37511

answer CHANGED
@@ -39,18 +39,18 @@
39
39
  }
40
40
 
41
41
  .bg_img .src1 {
42
- background-image : url("http://placehold.jp/150x150.png?text=doraemon_background_1.png"); /* 背景の画像を指定 */
42
+ background-image : url("doraemon_background_1.png"); /* 背景の画像を指定 */
43
43
  }
44
44
  .bg_img .src2 {
45
- background-image : url("http://placehold.jp/150x150.png?text=doraemon_kabegami1.png"); /* 背景の画像を指定 */
45
+ background-image : url("doraemon_kabegami1.png"); /* 背景の画像を指定 */
46
46
  animation-delay : 10s;
47
47
  }
48
48
  .bg_img .src3 {
49
- background-image : url("http://placehold.jp/150x150.png?text=doraemon_background2.png"); /* 背景の画像を指定 */
49
+ background-image : url("doraemon_background2.png"); /* 背景の画像を指定 */
50
50
  animation-delay : 20s;
51
51
  }
52
52
  .bg_img .src4 {
53
- background-image : url("http://placehold.jp/150x150.png?text=doraemon_kabegami1.png"); /* 背景の画像を指定 */
53
+ background-image : url("doraemon_kabegami1.png"); /* 背景の画像を指定 */
54
54
  animation-delay : 30s;
55
55
  }
56
56
  ```