Html 跑马灯应该从中间开始?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9887497/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 23:22:12  来源:igfitidea点击:

marquee should start from the middle?

htmlmarquee

提问by

I am using marquee to show the dashboard on my site, the marquee tag is written as:

我正在使用选取框在我的网站上显示仪表板,选取框标记写为:

<marquee loop="infinite" behavior="scroll" direction="up" scrollamount="1" height="500" width="500">
    .............
    .............
</marquee>

As you can see the marquee contents are scrolling from down to up.

如您所见,选取框内容正在从下向上滚动。

Problem

问题

When I hit the URL from browser, the place where marquee is used look empty and then the marquee content start coming from the bottom.

当我从浏览器点击 URL 时,使用选取框的地方看起来是空的,然后选取框内容从底部开始。

What I want is the marquee content should start from the middle rather than from the bottom.

我想要的是选取框内容应该从中间而不是从底部开始。

采纳答案by Mr Lister

The <marquee>element does not have this functionality. There are some proposals to create marquees with CSS3, but those are far from definitive.

<marquee>元素没有此功能。有一些建议使用 CSS3 创建选取框,但这些都远非最终确定。

So the only real alternative is to write one in javascript.

所以唯一真正的选择是用javascript编写一个。

回答by shazeerazly

This stops in the middle and starts at the middle:

这在中间停止并从中间开始:

<marquee BEHAVIOR="alternate" SCROLLAMOUNT="6" DIRECTION="down">

回答by Ravisanath

So when ever you use this code

所以当你使用这个代码时

<marquee loop="infinite" behavior="scroll" direction="up" scrollamount="1" height="500" width="500">
    .............
    .............
</marquee>

for the first block add style="margin-top:-value"so that it will starts from the middle.

对于第一个块添加,style="margin-top:-value"以便它从中间开始。

回答by RFerreira

In this case. Just set the style margin-top:-500px (-height_of_marquee) of the element wrapped by marquee should work.

在这种情况下。只需设置由选取框包裹的元素的样式 margin-top:-500px (-height_of_marquee) 即可。

回答by st mnmn

if you will change the attribute height of the marqee tag to 100 or something like this it wont start from the buttom

如果你将 marqee 标签的属性高度更改为 100 或类似的东西,它不会从底部开始