博客网站任意位置增补滚动字幕 :自定义文本+悬停暂停效果
科技 2026-09-03 12:12:05
0

安鹿分享在网站任意位置增补滚动字幕的博客本悬技术计划 。
通过CSS代码定义滚动动画效果 ,网站位置包括背景色、任意字体颜色 、增补字幕自定滚动速度及移动端适配 ,滚动果鼠标悬停可暂停动画。义文
HTML部分通过
标签包裹文本内容,停暂停效拥穿着自定义滚动文字。博客本悬
CSS
/*滚动字幕安鹿*/@media screen and(max-width: 500px){body .scroll-notice-animate {animation: 30s wordsLoop linear infinite normal;}}.scroll-notice {background:#0aa7e4;color:#fff;white-space:nowrap;overflow:hidden;}.scroll-notice a {color:#fff;}.scroll-notice-animate {padding-left:20px;animation:35s wordsLoop linear infinite normal;}.scroll-notice-animate:hover {animation-play-state:paused;}@keyframes wordsLoop {0% {transform:translateX(100%);}100% {transform:translateX(-100%);}/*滚动字幕安鹿*//*滚动字幕安鹿*/@media screen and 网站位置(max-width: 500px) { body .scroll-notice-animate { animation: 30s wordsLoop linear infinite normal; } }.scroll-notice { background:#0aa7e4; color:#fff; white-space:nowrap; overflow:hidden;}.scroll-notice a { color:#fff;}.scroll-notice-animate { padding-left:20px; animation:35s wordsLoop linear infinite normal;}.scroll-notice-animate:hover { animation-play-state:paused;}@keyframes wordsLoop { 0% { transform:translateX(100%);}100% { transform:translateX(-100%);}/*滚动字幕安鹿*//*滚动字幕安鹿*/@media screen and (max-width: 500px) { body .scroll-notice-animate { animation: 30s wordsLoop linear infinite normal; } }.scroll-notice { background:#0aa7e4; color:#fff; white-space:nowrap; overflow:hidden;}.scroll-notice a { color:#fff;}.scroll-notice-animate { padding-left:20px; animation:35s wordsLoop linear infinite normal;}.scroll-notice-animate:hover { animation-play-state:paused;}@keyframes wordsLoop { 0% { transform:translateX(100%);}100% { transform:translateX(-100%);}/*滚动字幕安鹿*/
滚动文本
在head ,或任意你需要的任意地方加入如下代码 。
<div class="scroll-notice"><div class="scroll-notice-animate">欢迎来到安鹿轩,增补字幕自定3533464073有任何尴尬请联系我!</div></div>欢迎来到安鹿轩,滚动果3533464073有任何尴尬请联系我!欢迎来到安鹿轩,义文停暂停效3533464073有任何尴尬请联系我!