我有一个随机生成到div中的文本。这个文本的宽度取决于当前生成的内容。只有当文本太长时,我想让它滚动起来。html:
<div id="random_word"> <!--here appears something--> </div>
CSS:
#random_word {
color: white;
position: absolute;
width: 50%;
left: 0%;
text-align: center;
font-size: 8vw;
margin-top: 22%;
font-variant: small-caps
text-shadow: 0 0 20px #000;
text-align: center;
z-index: 2;
overflow: hidden;
white-space: nowrap;
line-height: 100%;
}
我在互联网上找到了这个CSS属性:
overflow-x:-webkit-marquee;
,但我不确定如何使用它。有人可以帮忙吗?