system-copyright-react/src/components/scrollAD/scrollAd.css
2024-07-25 15:59:10 +08:00

51 lines
1.2 KiB
CSS
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

.scrolling-ad-container {
overflow: hidden;
/* 隐藏超出盒子的部分 */
white-space: nowrap;
/* 内容不换行 */
position: relative;
/* 使子元素的动画定位参考于此 */
padding: 10px;
/* 内容内边距 */
width: 100%;
/* 盒子的宽度 */
height: 50px;
/* 盒子的高度 */
display: flex;
align-items: center;
/* 垂直居中对齐文字 */
box-sizing: border-box;
/* 包含内边距和边框 */
}
.scrolling-ad-content {
display: inline-block;
font-size: 18px;
padding-left: 100%;
/* 确保广告从盒子外开始滚动 */
white-space: nowrap;
/* 内容不换行 */
animation: scrollLeft 20s linear infinite;
/* 滚动动画持续时间为20秒线性匀速无限循环 */
}
/* 定义动画 */
@keyframes scrollLeft {
0% {
transform: translateX(0);
/* 从容器的右边开始 */
}
100% {
transform: translateX(-100%);
/* 向左移动到容器的左边 */
}
}
/* 悬停时停止动画 */
.scrolling-ad-container:hover .scrolling-ad-content {
animation-play-state: paused; /* 悬停时动画暂停 */
/* 添加下划线 */
/* text-decoration: underline; */
/* 下划线颜色 */
/* text-decoration-color: red; */
}