Main Page/styles.css: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
} | } | ||
.text-container { | .text-container { | ||
position: relative; | |||
width: 200px; /* 可以根据需要调整 */ | |||
height: 50px; /* 可以根据需要调整 */ | |||
margin: 0 auto; /* 居中对齐 */ | |||
overflow: hidden; | |||
} | |||
.text-slide { | |||
position: absolute; | |||
width: 100%; | width: 100%; | ||
height: 100%; | |||
top: 0; | |||
left: 0; | |||
opacity: 0; | |||
animation: slide-animation 6s infinite; | |||
} | |||
.text-slide:nth-child(1) { | |||
animation-delay: 0s; | |||
} | |||
.text-slide:nth-child(2) { | |||
animation-delay: 2s; | |||
} | } | ||
.text | .text-slide:nth-child(3) { | ||
animation-delay: 4s; | |||
animation: | |||
} | } | ||
@keyframes | @keyframes slide-animation { | ||
0%, | 0%, 20% { | ||
opacity: 0; | |||
transform: translateX(0); | transform: translateX(0); | ||
} | } | ||
25%, 45% { | |||
transform: translateX(- | opacity: 1; | ||
transform: translateX(-1px); | |||
} | } | ||
30%, 40% { | |||
transform: translateX( | transform: translateX(1px); | ||
} | } | ||
50%, 100% { | |||
transform: translateX( | opacity: 0; | ||
transform: translateX(0); | |||
} | } | ||
} | } |
Revision as of 00:03, 25 October 2024
.mainpage-title{ font-size:1.6em; font-weight: bold; } .text-container { position: relative; width: 200px; /* 可以根据需要调整 */ height: 50px; /* 可以根据需要调整 */ margin: 0 auto; /* 居中对齐 */ overflow: hidden; } .text-slide { position: absolute; width: 100%; height: 100%; top: 0; left: 0; opacity: 0; animation: slide-animation 6s infinite; } .text-slide:nth-child(1) { animation-delay: 0s; } .text-slide:nth-child(2) { animation-delay: 2s; } .text-slide:nth-child(3) { animation-delay: 4s; } @keyframes slide-animation { 0%, 20% { opacity: 0; transform: translateX(0); } 25%, 45% { opacity: 1; transform: translateX(-1px); } 30%, 40% { transform: translateX(1px); } 50%, 100% { opacity: 0; transform: translateX(0); } }