Webkit template only scrolls if necessary

I have a question about webkit marquee. I have 2 elements of variable width. (2 elements have the same width) and both elements should be highlighted.

However, when the content has an overflow (larger than the element), I need selection if the text should not remain as it is (without scrolling).

As an example, I created JSFiddle: http://jsfiddle.net/Vxwed/ :

Long and short should both be highlighted using CSS3, while long should scroll, and short should not.

<p class="long">Hi my name is John Doe</p>
<p class="short">Yeah!</p>

Remember that the content of the elements is variable (filled with javascript), so I cannot perform the actual hardcoding for the behavior of the marquee elements.

Can all CSS experts help me? I understand this a lot, but there is little information about this topic, since it is relatively new.

The only solution I can think of right now is to use jQuery to measure the width of the elements and then calculate if they need extra distance. If they need to use a tent, then no. But this does not seem to me very clean, I would prefer to do it only in HTML / CSS.

+5
source share

All Articles