Science, Tech, Math › Computer Science Creating Scrollable Content in HTML5 and CSS3 Without MARQUEE Share Flipboard Email Print Stanislaw Pytel / Getty Images Science, Tech, Math PHP Programming Perl Python Java Programming Javascript Programming Delphi Programming C & C++ Programming Ruby Programming Visual Basic View More By Jennifer Kyrnin Jennifer Kyrnin Writer University of California University of Washington Jennifer Kyrnin is a professional web developer who assists others in learning web design, HTML, CSS, and XML. Learn about our Editorial Process Updated on February 20, 2020 Those of you who have been writing HTML for a long time may remember the element. This was a browser-specific element that created a banner of scrolling text across the screen. This element was never added to the HTML specification and support for it varied widely across browsers. People often had very strong opinions about the use of this element — both positive and negative. But whether you loved or hated it, it did serve the purpose of making content that overflowed the box boundaries visible. Part of the reason it was never fully implemented by browsers, aside from strong personal opinion, was that it is considered a visual effect and as such, it shouldn’t be defined by the HTML, which defines the structure. Instead, visual or presentation effects should be managed by CSS. And CSS3 adds the marquee module to control how browsers add the marquee effect to elements. New CSS3 Properties CSS3 adds five new properties to help control how your content displays in the marquee: overflow-style, marquee-style, marquee-play-count, marquee-direction and marquee-speed. overflow-styleThe overflow-style property (which we also discussed in the article CSS Overflow) defines the preferred style for contents that overflows the content box. If you set the value to marquee-line or marquee-block your content will slide in and out to the left/right (marquee-line) or up/down (marquee-block). marquee-styleThis property defines how the content will move into view (and out). The options are scroll, slide, and alternate. Scroll starts with the content completely off screen, and then it moves across the visible area until it is all completely off screen again. Slide starts with the content completely off screen and then it moves across until the content has fully moved onto the screen and there is no more content left to slide on the screen. Lastly, alternate bounces the content from side to side, sliding back and forth. marquee-play-countOne of the drawbacks of using the MARQUEE element is that the marquee never stops. But with the style property marquee-play-count you can set the marquee to rotate the content on and off for a specific number of times. marquee-directionYou can also choose the direction that the content should scroll on the screen. The values forward and reverse are based on the directionality of the text when the overflow-style is marquee-line and up or down when the overflow-style is marquee-block. Marquee-Direction Details overflow-style Language Direction forward reverse marquee-line ltr left right rtl right left marquee-block up down marquee-speedThis property determines how quickly the content scrolls on the screen. The values are slow, normal, and fast. The actual speed depends upon the content and the browser displaying it, but the values must be slow is slower than normal which is slower than fast. Browser Support of the Marquee Properties You may need to use vendor prefixes to get the CSS marquee elements to work. They are as follows: CSS3 Vendor Prefix overflow-x: marquee-line; overflow-x: -webkit-marquee; marquee-style -webkit-marquee-style marquee-play-count -webkit-marquee-repetition marquee-direction: forward|reverse; -webkit-marquee-direction: forwards|backwards; marquee-speed -webkit-marquee-speed no equivalent -webkit-marquee-increment The last property allows you to define how large or small the steps should be as the content scrolls on screen in the marquee. In order to have your marquee working, you should place the vendor prefixed values first and then follow them with the CSS3 specification values. For example, here is the CSS for a marquee that scrolls the text five times from left to right inside a 200x50 box. {width: 200px; height: 50px; white-space: nowrap;overflow: hidden;overflow-x:-webkit-marquee;-webkit-marquee-direction: forwards;-webkit-marquee-style: scroll;-webkit-marquee-speed: normal;-webkit-marquee-increment: small;-webkit-marquee-repetition: 5;overflow-x: marquee-line;marquee-direction: forward;marquee-style: scroll;marquee-speed: normal;marquee-play-count: 5;} Cite this Article Format mla apa chicago Your Citation Kyrnin, Jennifer. "Creating Scrollable Content in HTML5 and CSS3 Without MARQUEE." ThoughtCo, Sep. 30, 2021, thoughtco.com/scrollable-content-html5-css3-without-marquee-3467007. Kyrnin, Jennifer. (2021, September 30). Creating Scrollable Content in HTML5 and CSS3 Without MARQUEE. Retrieved from https://www.thoughtco.com/scrollable-content-html5-css3-without-marquee-3467007 Kyrnin, Jennifer. "Creating Scrollable Content in HTML5 and CSS3 Without MARQUEE." ThoughtCo. https://www.thoughtco.com/scrollable-content-html5-css3-without-marquee-3467007 (accessed March 22, 2023). copy citation By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. Cookies Settings Accept All Cookies