CSS ã§èæ¯è²ãè¹è²ã§å€ããã¢ãã¡ãŒã·ã§ã³ããã£ãŠã¿ã
åºæ¥äžãã£ããã€ã®ã€ã¡ãŒãžã¯ãããªæã
See the Pen Untitled by sueasen (@sueasen) on CodePen.
- html ã¯æ ã ã
index.html
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" href="./style.css">
</head>
</html>
- css ã§ã¢ãã¡ãŒã·ã§ã³èšå®
style.css
@charset "utf-8";
html {
animation-name: rainbow;
animation-duration: 7s;
animation-iteration-count: infinite;
/**
animation: rainbow 7s infinite;
*/
}
@keyframes rainbow {
0% {
background-color: red;
}
13% {
background-color: orange;
}
26% {
background-color: yellow;
}
39% {
background-color: green;
}
52% {
background-color: aqua;
}
65% {
background-color: aqua;
}
78% {
background-color: blue;
}
91% {
background-color:purple;
}
100% {
background-color: red;
}
}
- å°ãã¿ïŒïŒïŒèæ¯ç»åã¹ã©ã€ã
body {
background-image: url(./imagePath/example/image.jpg);
background-size: 100vw 100vh; /* ç»é¢ãµã€ãº 暪100vw, 瞊100vh*/
background-attachment: fixed;
animation: slide 5s linear infinite;
}
@keyframes slide {
0% {
background-position: 0 0;
}
100% {
background-position: -100vw -100vh; /* ç»é¢ãµã€ãºã«åããã + ã¯å³äž, - ã¯å·Šäžã«ã¹ã©ã€ã*/
}
}