How to Make a Scrolling Marquee in HTML

Method 1 of 2:

Using CSS

  1. How to Make a Scrolling Marquee in HTML Picture 1
    If you're on a Mac, download the latest version of webkit.[1] Since the CSS module that can create marquees is a part of the webkit specification, you will need to get webkit installed on your machine.
  2. How to Make a Scrolling Marquee in HTML Picture 2
    If you're using Windows, download the developer toolset. Unlike on Mac, there is no self-extracting installer for Windows. Windows users will need to install a number of developer tools to use webkit. All necessary tools and specifications can be downloaded here
  3. How to Make a Scrolling Marquee in HTML Picture 3
    Add a CSS reference to your HTML file. Open your HTML file and reference your CSS style sheet with the following code:
    .
    1. You can write the CSS reference before creating the CSS file, but you must be sure that the CSS filename matches the one in your code (in this example, 'mystyle.css").
    2. Your HTML and CSS code will remain separate, but run together when you load your HTML file.[2]
  4. How to Make a Scrolling Marquee in HTML Picture 4
    Create a 'div' line in your HTML file. Your code might look something like:
    .
    Scrolling text goes here.
    1. div is an HTML element that defines the area on the page that will contain components of the code, in this case your scrolling marquee.
  5. How to Make a Scrolling Marquee in HTML Picture 5
    Save your HTML file. 'Go to File > Save As…' Append your HTML file with a .html extension.
  6. How to Make a Scrolling Marquee in HTML Picture 6
    Open a separate text document for your CSS style sheet. The shorthand syntax for creating a scrolling marquee with CSS is : '-webkit-marquee: [direction] [increment] [repetition] [style] [speed]'. The webkit tag is necessary because the CSS module that contains the marquee class is part of the Webkit CSS specification.[3]
    1. [direction] will define which direct the marquee scrolls
    2. [increment] measures the pixel distance between each step of the scroll
    3. [repetition] is the number of times the marquee will run
    4. [style] can determine a simple scroll or bouncing text
    5. [speed] is how fast the text moves.
  7. How to Make a Scrolling Marquee in HTML Picture 7
    Set values to define the marquee. Set the values in the brackets (remove the brackets, since they are just a placeholder). This will tell your marquee how to act on the page. Your code might look like:
    .-webkit-marquee: auto medium infinite scroll normal;
    1. The 'auto' direction uses the default right-to-left, 'medium' sets a default interval of 6 pixels, 'infinite' sets the marquee to run an unlimited number of times, 'scroll' sets the style to a linear movement, and 'normal' is a default setting for scrolling speed.
  8. How to Make a Scrolling Marquee in HTML Picture 8
    Set an 'overflow' on a new line. Add .overflow-x: -webkit-marquee; to a new line in your code. This will make the text scroll continuously along instead of stopping at the edge of the div.[4]
    1. 'overflow-x' specifies what to do with text that exceeds the limit of the space on the x-axis.
    2. '-webkit-marquee' is directing the overflow command towards the marquee module in webkit.
    3. Your full code might look like:
      .-webkit-marquee: auto medium infinite scroll normal;
      overflow-x: -webkit-marquee;
  9. How to Make a Scrolling Marquee in HTML Picture 9
    Save your CSS file. 'Go to File > Save As…' Append your CSS file with a .css extension.
  10. How to Make a Scrolling Marquee in HTML Picture 10
    Open your HTML file with your browser. Drag and drop the file to your browser to open. Your scrolling marquee will display on the page.
    1. Use a webkit supported browser, like Chrome or Safari to make sure the marquee displays as expected.
Method 2 of 2:

Using HTML

  1. How to Make a Scrolling Marquee in HTML Picture 11
    Open your HTML document. Note that using the HTML marquee tag is outdated and strongly discouraged in web design. HTML files can be opened with a simple text editor If you are starting from scratch, open a text file and enter this sample code:
    1. .This is a scrolling marquee
  2. How to Make a Scrolling Marquee in HTML Picture 12
    Set a background color. You can change the background of your marquee by specifying a hexadecimal (hex) value, or a RGB (Red Green Blue) value after the "background-color:" part of the code. The default value listed in the sample code, #000080, is navy blue.
    1. For example:
      .
    2. A full list of colors and their values can be found online.[5]
  3. How to Make a Scrolling Marquee in HTML Picture 13
    Set a scrolling direction. Change the 'direction' attribute in the code to any of the following: right, left, up or down.
    1. For example:
      .
  4. How to Make a Scrolling Marquee in HTML Picture 14
    Specify the number of loops for your marquee. The 'loop' attribute controls how many times the marquee should loop. If you want it to run continuously, leave out this attribute entirely.
    1. An example with the attribute omitted could be:
      .This is a scrolling marquee
  5. How to Make a Scrolling Marquee in HTML Picture 15
    Specify the marquee text. The text inside the tag and the tag will be the scrolling text of your marquee. Write whatever you want your marquee to say here.
    1. For example:
      .Watch this text scroll by!
  6. How to Make a Scrolling Marquee in HTML Picture 16
    Load your HTML file. Drag and drop the file to your browser to open. Your scrolling marquee will display on the page.
3.8 ★ | 8 Vote

May be interested

  • Why write neat and organized HTML?Why write neat and organized HTML?
    you will get many benefits from writing clean and precise html code. here's why it's a good idea to write optimal html code.
  • Instructions for scrolling TikTok videos automaticallyInstructions for scrolling TikTok videos automatically
    tiktok supports users a lot of actions for videos when you watch videos, such as adjusting the speed of playing tiktok videos, shortening the delivery of videos to watching tiktok videos or automatically scrolling tiktok videos automatically.
  • HTML formHTML form
    the form in html contains form elements - the element types that take input data such as filling in text fields, checkboxes, buttons, submit buttons ...
  • Why are websites scrolling vertically and not horizontal scrolling?Why are websites scrolling vertically and not horizontal scrolling?
    visiting any website we see them designed to scroll up and down to display content instead of translating to horizontal. why so?
  • How to make PIN Pad using HTML CSS & JavaScriptHow to make PIN Pad using HTML CSS & JavaScript
    this article will show you how to implement a pin entry table and check whether it is valid or not with the help of html, css, and javascript.
  • Style properties in HTMLStyle properties in HTML
    the style attribute specifies the style for the html element.
  • Text in HTMLText in HTML
    the element in html is used to define a paragraph of text.
  • How to Use Text Color Tags in HTMLHow to Use Text Color Tags in HTML
    this article explains how to change the font color in html documents. although the html style tag is obsolete in html5, you can use css to color content on an html page. if you use an older version of html, you can use the html text color tag as needed.
  • Format text in HTMLFormat text in HTML
    format elements in html help determine the style and importance of text.
  • Elements in HTMLElements in HTML
    the html element usually goes in pairs, including the opening tag, closing tag, and the content inside the two tags.