Skip to content

Marquee Generator

Presets One click to load a look, then fine-tune it

Code
Items

Text, emoji, or a link: Sale ends Sunday | https://example.com/sale. A picture: image: https://example.com/logo.png | Logo name

Between items
Movement
Direction
Style

Pausing and edges
Text
Colors

Box
Page

Hover it to test pausing. Press Tab to reach the Pause button.

Your code

<style>
  .marquee {
    --marquee-gap: 32px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    padding: 10px 16px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    color: #f9fafb;
    background-color: #0b0f19;
  }

  .marquee-viewport {
    display: flex;
    gap: var(--marquee-gap);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    overflow: clip;
  }

  .marquee-group {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    justify-content: space-around;
    min-width: 100%;
    gap: var(--marquee-gap);
    margin: 0;
    padding: 0;
    list-style: none;
    animation: marquee-scroll-x 30s linear infinite;
  }

  .marquee-item {
    display: flex;
    align-items: center;
    gap: var(--marquee-gap);
    white-space: nowrap;
  }

  .marquee-sep {
    opacity: 0.7;
  }

  .marquee a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 0.15em;
  }

  .marquee a:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: -2px;
  }

  .marquee:hover .marquee-group,
  .marquee-pause-input:checked ~ .marquee-viewport .marquee-group {
    animation-play-state: paused;
  }

  .marquee-pause-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
  }

  .marquee-pause {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid currentColor;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
  }

  .marquee-pause-play {
    display: none;
  }

  .marquee-pause-input:checked + .marquee-pause .marquee-pause-text {
    display: none;
  }

  .marquee-pause-input:checked + .marquee-pause .marquee-pause-play {
    display: inline;
  }

  .marquee-pause::before {
    content: "";
    box-sizing: border-box;
    width: 9px;
    height: 11px;
    border-style: solid;
    border-width: 0 3px;
    border-color: currentColor;
  }

  .marquee-pause-input:checked + .marquee-pause {
    color: #0b0f19;
    background-color: #f9fafb;
    border-color: #f9fafb;
  }

  .marquee-pause-input:checked + .marquee-pause::before {
    border-width: 5.5px 0 5.5px 9px;
    border-color: transparent transparent transparent currentColor;
  }

  .marquee-pause-input:focus-visible + .marquee-pause {
    outline: 2px solid #f9fafb;
    outline-offset: 2px;
  }

  @keyframes marquee-scroll-x {
    from {
      transform: translateX(0);
    }
    to {
      transform: translateX(calc(-100% - var(--marquee-gap)));
    }
  }

  .marquee-viewport:has(a:focus-visible) .marquee-group {
    animation: none;
    flex-wrap: wrap;
    justify-content: center;
    min-width: 0;
    flex-shrink: 1;
  }

  .marquee-viewport:has(a:focus-visible) .marquee-group[aria-hidden="true"] {
    display: none;
  }

  .marquee-viewport:has(a:focus-visible) .marquee-item {
    white-space: normal;
  }

  .marquee-viewport:has(a:focus-visible) .marquee-sep {
    display: none;
  }

  @media (prefers-reduced-motion: reduce) {
    .marquee-group {
      animation: none;
      flex-wrap: wrap;
      justify-content: center;
      min-width: 0;
      flex-shrink: 1;
    }
    .marquee-group[aria-hidden="true"] {
      display: none;
    }
    .marquee-item {
      white-space: normal;
    }
    .marquee-sep {
      display: none;
    }
    .marquee-pause,
    .marquee-pause-input {
      display: none;
    }
  }
</style>

<div class="marquee">
  <input type="checkbox" id="marquee-pause" class="marquee-pause-input" aria-label="Pause">
  <label for="marquee-pause" class="marquee-pause"><span class="marquee-pause-text">Pause</span><span class="marquee-pause-play">Play</span></label>
  <div class="marquee-viewport">
    <ul class="marquee-group">
      <li class="marquee-item"><a href="https://example.com/news">Our new store opens on Saturday</a><span class="marquee-sep" aria-hidden="true">•</span></li>
      <li class="marquee-item">Summer hours: 9am to 6pm every day<span class="marquee-sep" aria-hidden="true">•</span></li>
      <li class="marquee-item"><a href="https://example.com/events">Free workshop: HTML basics for beginners</a><span class="marquee-sep" aria-hidden="true">•</span></li>
      <li class="marquee-item">Gift cards are back in stock<span class="marquee-sep" aria-hidden="true">•</span></li>
    </ul>
    <ul class="marquee-group" aria-hidden="true">
      <li class="marquee-item"><a href="https://example.com/news" tabindex="-1">Our new store opens on Saturday</a><span class="marquee-sep" aria-hidden="true">•</span></li>
      <li class="marquee-item">Summer hours: 9am to 6pm every day<span class="marquee-sep" aria-hidden="true">•</span></li>
      <li class="marquee-item"><a href="https://example.com/events" tabindex="-1">Free workshop: HTML basics for beginners</a><span class="marquee-sep" aria-hidden="true">•</span></li>
      <li class="marquee-item">Gift cards are back in stock<span class="marquee-sep" aria-hidden="true">•</span></li>
    </ul>
  </div>
</div>

Checks

  • Put the <style> block in your page's <head> (or the CSS in your stylesheet), and the HTML where the scrolling bar should go.
  • The items are in the code twice. The second copy has aria-hidden="true" (and its links can’t be reached with Tab), so screen readers read everything once. It’s only there so the loop never shows a gap.
  • People who turn on “reduce motion” in their system settings see the items standing still, wrapped onto more lines if needed, so nothing is cut off.
  • The Pause button works with a mouse, a finger and the keyboard (Tab to it, Space to press it), which covers WCAG 2.2.2: moving text that runs longer than 5 seconds needs a way to pause it.
  • Using more than one on a page? Give each a different class name, so their Pause buttons don't share the id "marquee-pause".
  • When someone reaches a link with the Tab key, the bar stops and shows all the items standing still, so the focused link is always in view.

HTML Marquee Generator: Scrolling Text With CSS

What Is a Marquee?

A marquee is a strip of text that scrolls across the page by itself, like the news ticker at the bottom of a TV channel or the “Free shipping this week” bar at the top of a shop. The name comes from the old HTML <marquee> tag, which did exactly that. Today the same effect is usually made with a CSS animation.

This generator writes the code for you. Type your items (text, emoji, links or small pictures), pick the direction, speed and colors, and watch the real result in the preview. Then copy modern CSS code, or the old tag if that's what you need. It all runs in your browser, and your last marquee is remembered for next time.

How to Use It, Step by Step

Five quick steps. The preview runs the exact code you copy.

Step 1 Pick a Preset

Click a tile under Presets: News ticker, Announcement bar, Row of names, Stock ticker style, Vertical notices, Bouncing text, Sale banner or Emoji row. If you haven't typed your own items yet, the preset brings sample text along. Once you have, it only changes the look.

Step 2 Type Your Items

Put one item on each line in the Items box. Three kinds of lines work:

  • Text or emoji: Gift cards are back in stock 🎁
  • A link: the text, a bar, then the address: Big sale | https://example.com/sale
  • A picture: image: https://example.com/logo.png | Shop logo (the part after the bar is the alt text)

Pick a separator to go between items, like a dot or a star. Quotes, < and & are escaped in the code, so they can't break your page.

Step 3 Set the Movement

Choose a Direction (left, right, up or down) and a Style: Loop goes round and round, Bounce slides to the other side and back. Set the speed in seconds per loop, or type a speed in pixels per second and the tool works out the seconds. For up and down, set the window height.

Step 4 Style It and Make It Pausable

Change the font, colors, padding, border and corners. Keep Pause on hover and the Pause button on: they let people stop the text to read it, and the button works with the keyboard too. Fade the edges makes the text melt in and out at the sides.

Step 5 Copy the Code

Read the Checks under the code, then press Copy all (or Copy HTML and Copy CSS separately), or Download a small page to try on its own. Put the <style> block in your page's <head> and the HTML where the bar should go.

💡 Want the old tag? Pick Old <marquee> tag at the top of the controls. It's one element with inline styles, so it's easy to paste into places that don't allow a <style> block.

Modern CSS or the Old <marquee> Tag?

Both make text scroll. The tag is shorter to write, but CSS does the job better in almost every way:

<marquee> tag Modern CSS
Part of today’s HTML No, it’s obsolete Yes
How it moves In small jumps Smoothly
Loop without a gap No, it waits until the text has left Yes, with a second copy
Pause on hover Needs onmouseover One CSS rule
Pause with the keyboard No Yes, with a Pause button
Stops for “reduce motion” No Yes

The <marquee> Tag

The tag needs nothing else: wrap your text in <marquee> and it scrolls from right to left, forever. It started as a browser extra in the 1990s. Today it's obsolete in the HTML standard: it's still described there so browsers keep running it and old pages don't break, but new pages shouldn't use it, and validators like the HTML Validator flag it.

The code:

<marquee>Hello! I'm the old marquee tag.</marquee>

You'll see:

Its attributes control the movement:

Attribute What it does Default
behavior scroll goes round and round, slide comes in once and stops, alternate bounces between the edges. scroll
direction Which way it moves: left, right, up or down. left
scrollamount How many pixels it moves each step. Bigger is faster. 6
scrolldelay Milliseconds between steps. Smaller is faster, but browsers raise anything under 60 to 60. 85
truespeed Lets scrolldelay go under 60. Very fast and jumpy. off
loop How many times it runs. -1 means forever. -1
width, height The size of the box. Up and down need a height. auto
bgcolor Background color. Use CSS background-color instead. none
hspace, vspace Space outside the box. Use CSS margin instead. 0

Bounce with behavior="alternate":

<marquee behavior="alternate" scrollamount="3"
         style="background: #fef9c3; padding: 8px;">
  I bounce from side to side
</marquee>

You'll see:

How the CSS Marquee Works

The CSS version uses a box with overflow: hidden and moves the items inside it with transform: translateX() in a @keyframes animation. The trick for a loop without a gap is to put the items in twice. Both copies move left by exactly one copy's width plus the gap, then start again. At that moment the second copy is exactly where the first one began, so the restart can't be seen.

The code (a short version of what the generator writes):

<style>
  .marquee {
    --gap: 24px;
    display: flex;
    gap: var(--gap);
    overflow: hidden;
    padding: 8px 0;
    color: #ffffff;
    background-color: #0b0f19;
  }
  .marquee-group {
    display: flex;
    flex-shrink: 0;
    justify-content: space-around;
    gap: var(--gap);
    min-width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    animation: scroll 12s linear infinite;
  }
  .marquee:hover .marquee-group {
    animation-play-state: paused;
  }
  @keyframes scroll {
    to {
      transform: translateX(calc(-100% - var(--gap)));
    }
  }
  @media (prefers-reduced-motion: reduce) {
    .marquee-group {
      animation: none;
    }
  }
</style>
<div class="marquee">
  <ul class="marquee-group">
    <li>First news item</li>
    <li>Second news item</li>
    <li>Third news item</li>
  </ul>
  <ul class="marquee-group" aria-hidden="true">
    <li>First news item</li>
    <li>Second news item</li>
    <li>Third news item</li>
  </ul>
</div>

You'll see (hover it to pause):

Change the Speed

A CSS animation has a length in seconds, not a speed. animation: scroll 20s linear infinite means one loop takes 20 seconds, however long the text is. So if you add more items, the text has further to go in the same time and moves faster. That's why the generator shows the speed in pixels per second next to the seconds, and lets you type either one. Start slow, then speed up only as long as you can still read it comfortably.

The old tag works the other way round: it moves scrollamount pixels every scrolldelay milliseconds. scrollamount="6" and scrolldelay="85" (the defaults) make about 70 pixels a second, whatever the length of the text.

Make It Pause

animation-play-state: paused freezes a CSS animation where it is. Put it on :hover to pause while the mouse is over the bar. Pausing alone isn't enough when someone tabs to a link: the link might be outside the window at that moment. So when a link has keyboard focus, the generator's code stops the bar and lays all the items out standing still, with the focused link in view. For keyboard and phone users, add a Pause button. The generator uses a real checkbox styled as a button, so it works without any JavaScript: Tab to it and press Space.

<style>
  /* Pause while the mouse is over it */
  .marquee:hover .marquee-group {
    animation-play-state: paused;
  }

  /* A link reached with Tab: stand still and show every item,
     so the focused link is never outside the window */
  .marquee-viewport:has(a:focus-visible) .marquee-group {
    animation: none;
    flex-wrap: wrap;
  }
  .marquee-viewport:has(a:focus-visible) .marquee-group[aria-hidden="true"] {
    display: none;
  }

  /* A Pause button: a real checkbox, styled as a button */
  .marquee-pause-input:checked ~ .marquee-viewport .marquee-group {
    animation-play-state: paused;
  }
</style>
<div class="marquee">
  <input type="checkbox" id="marquee-pause" class="marquee-pause-input">
  <label for="marquee-pause" class="marquee-pause">Pause</label>
  <div class="marquee-viewport">…the two groups…</div>
</div>

The old tag can only pause with a little JavaScript in its attributes:

<marquee onmouseover="this.stop()" onmouseout="this.start()">
  Hover me to stop me
</marquee>

Some site builders and many email apps remove onmouseover, so test it where you paste it.

Scroll Text Up or Down

For a column of notices that moves up, use the same idea with flex-direction: column, translateY() and a fixed height. The height is needed: without it the box grows to fit all the items and there's nothing left to scroll. In the generator, pick the Up or Down arrow.

The code:

<style>
  .notices {
    --gap: 12px;
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    height: 90px;
    overflow: hidden;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
  }
  .notices-group {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    justify-content: space-around;
    gap: var(--gap);
    min-height: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    animation: up 8s linear infinite;
  }
  @keyframes up {
    to {
      transform: translateY(calc(-100% - var(--gap)));
    }
  }
  @media (prefers-reduced-motion: reduce) {
    .notices-group {
      animation: none;
    }
  }
</style>
<div class="notices">
  <ul class="notices-group">
    <li>Closed on Monday</li>
    <li>New opening hours</li>
    <li>Book club on Thursday</li>
  </ul>
  <ul class="notices-group" aria-hidden="true">
    <li>Closed on Monday</li>
    <li>New opening hours</li>
    <li>Book club on Thursday</li>
  </ul>
</div>

You'll see:

Make Your Marquee Accessible

What This Generator Doesn't Do

Need a button next to your bar? Try the HTML Button Generator. Pick colors with the HTML Color Picker, and try the whole page in the HTML Editor.

Frequently Asked Questions

How do I make scrolling text in HTML?

There are two ways. The old one is the <marquee> tag: <marquee>Hello!</marquee> scrolls its text from right to left with no CSS at all. The modern way is a CSS animation: put the text in a box with overflow hidden and move it with @keyframes and transform: translateX(). The CSS way runs smoother, can pause, and stops for people who turn on “reduce motion”. This generator writes either one for you.

Is the <marquee> tag still supported?

Yes, every big browser still runs it, and they will for a long time because old pages use it. But it’s obsolete in the HTML standard, so validators flag it, and it has no built-in way to respect “reduce motion” or to pause from the keyboard. It’s fine for a quick test or a fun personal page. For a real site, use the Modern CSS code.

Why does my CSS marquee jump or leave a gap at the end?

When the text moves by its own width and starts again, there’s an empty stretch before it comes back, and then it jumps. The fix is to put the items in the code twice, side by side, and move both by exactly one copy’s width plus the gap. When the loop restarts, the second copy is exactly where the first one began, so you can’t see the jump. The second copy gets aria-hidden="true" so screen readers don’t read everything twice. The generator does all of this for you.

How do I make a marquee pause on hover?

With CSS, add .marquee:hover .marquee-group { animation-play-state: paused; }. The generator also stops the bar and shows every item standing still while a link inside has keyboard focus, so the focused link is always in view. With the old tag, add onmouseover="this.stop()" onmouseout="this.start()" to the <marquee> tag. Hover doesn’t help keyboard or phone users, so also turn on the Pause button in the generator.

How do I change the speed of a marquee?

In CSS the speed is the time for one loop, like animation: marquee-scroll-x 20s linear infinite. More seconds is slower. Because it’s a time, longer text moves faster in the same number of seconds, so check it again after you change the text. With the old tag, scrollamount is how many pixels it moves per step (the default is 6) and scrolldelay is the wait between steps in milliseconds (the default is 85, and browsers won’t go below 60).

How do I make text scroll up or down?

Pick the Up or Down arrow under Direction. Vertical scrolling needs a fixed height, because the box has to know how much to show at once, so the generator adds one (you can change it). In the CSS version the items stack in a column and move with translateY(). With the old tag it’s direction="up" plus a height in the style.

Are marquees bad for accessibility?

They can be. Moving text is hard to read for many people and can make some feel ill. WCAG 2.2.2 (Pause, Stop, Hide) says that text that moves on its own for more than 5 seconds needs a way to pause, stop or hide it. The CSS from this generator stops moving for people who turn on “reduce motion”, can pause on hover, and can include a Pause button that works with the keyboard. Also don’t put anything people must read only in a moving bar.

Can I put links, emoji or images in a marquee?

Yes. Emoji are just text, so type them in. For a link, write the text, a bar and the address: Big sale | https://example.com/sale. For a picture, start the line with image: and add the alt text after a bar: image: https://example.com/logo.png | Shop logo. Picture addresses must start with https://, and links can’t be javascript: or data: addresses, so nothing unsafe ends up in your code.