在CSS中,我们可以使用一些属性来让文本滚动。让我们来看看这些属性。第一种属性是overflow。当设置为“scroll”时,文本将在固定的高度和宽度内滚动。例如:div { height: 100p
div { height: 100px; width: 200px; overflow: scroll; }
<div> <marquee behavior="scroll" direction="left">这是滚动的文字</marquee> </div>
@keyframes scroll { 0% { transform: translateX(0); } 100% { transform: translateX(-100%); } } div { white-space: nowrap; overflow: hidden; } p { display: inline-block; animation: scroll 10s linear infinite; }
粉丝
0
关注
0
收藏
0