选取文本滑动到div的中心 [英] Marquee text sliding to center of div

查看:69
本文介绍了选取文本滑动到div的中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下选取框:

< div id =tip>< marquee loop =1direction = rightbehavior =slide> Text< / marquee>< / div>

上面的代码将文本从左移向右,停在div的右边缘。有没有办法强制它停止在div的中心?我无法使用填充,因为文本是随机的,并且没有固定长度。



当前行为:

 
---------------------------------------- ----------------------------------
> >>>>>>>> Text
------------------------------------------------ --------------------------

我想要的行为:

 
-------------------------- ------------------------------------------------
>>> >>>> Text
------------------------------------- -------------------------------------


解决方案

不会建议你使用选取框,但如果你真的想,那么你可以做到这一点来获得你想要的效果。 b

 < div id =tip> 
< div class =stop>
< marquee loop =1direction =rightbehavior =slide> Text< / marquee>
< / div>
< / div>

css

  .stop {width:*您的选择*;} 


I have the following marquee:

<div id="tip"><marquee loop="1" direction="right" behavior="slide">Text</marquee></div>

The above code moves the text from left to right and stops at right edge of div. Is there a way to force it to stop in center of div? I can't use paddings because the text is random and doesn't have a fixed length.

current behavior:

--------------------------------------------------------------------------
 >      >      >      >      >      >       >      >      >          Text
--------------------------------------------------------------------------

My desired behavior:

--------------------------------------------------------------------------
    >    >     >    >     >     >   Text
--------------------------------------------------------------------------

解决方案

would not advice you to use marquee but if you really want to, then you can do this to get your desired effect

<div id="tip">
<div class="stop">
<marquee loop="1" direction="right" behavior="slide">Text</marquee>
</div>
</div>

css

.stop{width:*your choice*;}

这篇关于选取文本滑动到div的中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆