所以我想把这个糟糕的动画放在屏幕的底部。很简单,对吧?
没有。当我戴上position: absolute
时marquee-container
,动画似乎从屏幕上消失了。
我想我在这里做了一些非常愚蠢的事情,但我看不出是什么。
所以我想把这个糟糕的动画放在屏幕的底部。很简单,对吧?
没有。当我戴上position: absolute
时marquee-container
,动画似乎从屏幕上消失了。
我想我在这里做了一些非常愚蠢的事情,但我看不出是什么。
The problem is that when you apply the absolute positioning to the container, 'display: block;
no longer stretches it to 100% of its container's width, and since it has no relatively-positioned contents to define its dimensions, it relies solely on explicitly defined values (height: 24px
) or zero if none exist. I've fixed the problem for you by defining width: 100%
for your containing element. I've also added a few tweaks to make the size and behavior of your marquee a little more robust given varying text lengths:
我能够通过从absolute
to更改fixed
并应用bottom:0px;
到它来使其工作。
见这里:http: //jsfiddle.net/Wdrgv/1/