我有以下选取框:
<div id="tip"><marquee loop="1" direction="right" behavior="slide">Text</marquee></div>
以上代码将文本从左向右移动并停在 div 的右边缘。有没有办法强制它停在 div 的中心?我不能使用填充,因为文本是随机的并且没有固定长度。
当前行为:
-------------------------------------------------------------------------- > > > > > > > > > Text --------------------------------------------------------------------------
我想要的行为:
-------------------------------------------------------------------------- > > > > > > Text --------------------------------------------------------------------------
最佳答案
不建议你使用选取框,但如果你真的想要,那么你可以这样做以获得你想要的效果
<div id="tip">
<div class="stop">
<marquee loop="1" direction="right" behavior="slide">Text</marquee>
</div>
</div>
CSS
.stop{width:*your choice*;}
关于html - 滑动到 div 中心的字幕文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9208662/