Search code examples
htmlcssmarquee

The <marquee> is block element or inline element?


I write a html/css code, and find the <marquee> and <span>'s layout is strange:

enter image description here

if <marquee> is a inline element, the span will on the right of the marquee, but if I use the span float right, it will like this:

enter image description here

So the <marquee> is not a block element.

How does the <marquee> display in html?


Solution

  • You should avoid to use this tag: It's not a standard element. See yourself: https://www.w3.org/wiki/HTML/Elements/marquee

    To replace it, you should use some javascript, or use a plugin :

    https://remysharp.com/2008/09/10/the-silky-smooth-marquee/

    You can achieve to do that in pure css to with animations : http://codepen.io/thomasbormans/pen/EjMBqO

    @keyframes marquee {
        0%   { transform: translate(0, 0); }
        100% { transform: translate(-100%, 0); }
    }