<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Quotelinks Developer Blog]]></title><description><![CDATA[Quotelinks Developer Blog]]></description><link>https://quotelinks.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 28 Nov 2026 22:07:14 GMT</lastBuildDate><atom:link href="https://quotelinks.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How to Embed a Stock Ticker Using HTML]]></title><description><![CDATA[A scrolling stock ticker for any website in two lines of HTML: no API key, no build step, and no framework required.]]></description><link>https://quotelinks.hashnode.dev/how-to-embed-a-stock-ticker-using-html</link><guid isPermaLink="true">https://quotelinks.hashnode.dev/how-to-embed-a-stock-ticker-using-html</guid><category><![CDATA[HTML]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[webdev]]></category><category><![CDATA[finance]]></category><dc:creator><![CDATA[Quotelinks]]></dc:creator><pubDate>Sat, 28 Nov 2026 03:32:48 GMT</pubDate><content:encoded><![CDATA[<p>A scrolling stock ticker is one of those features that looks simple until you try to build it. You need a quote source, an API key you don't want to expose in client code, a CSS animation that doesn't jank, a pause on hover, dark mode, and a plan for what happens when the data request fails.</p>
<p>If you just want the strip on your page, you can skip all of that. This tutorial shows how to embed a free ticker tape with plain HTML, how to configure it, where to place it in common layouts, and how to make it work in React and Next.js.</p>
<h2>The embed</h2>
<p>Paste this where you want the ticker to appear:</p>
<pre><code class="language-html">&lt;div class="ql-tickertape" data-symbols="AAPL,MSFT,NVDA,AMZN,SPY,QQQ" data-theme="light"&gt;
  Stock quotes by &lt;a href="https://www.quotelinks.com/"&gt;Quotelinks&lt;/a&gt;
&lt;/div&gt;
&lt;script src="https://www.quotelinks.com/widgets/tickertape.js" async&gt;&lt;/script&gt;
</code></pre>
<p>That's the whole integration. The <code>&lt;div&gt;</code> is a placeholder that holds your settings, and the script finds every <code>.ql-tickertape</code> element on the page and turns it into a scrolling strip with each symbol's latest price and daily change. Clicking a symbol opens its quote page in a new tab, so your visitor's page stays open.</p>
<p>If JavaScript is disabled or blocked, the div's text and link are shown instead, so the page never ends up with an empty gap or a broken box.</p>
<p>You can also build the code visually on the <a href="https://www.quotelinks.com/widgets/tickertape.html">ticker tape widget page</a>, which has a live preview and a copy button.</p>
<h2>Configuration with data attributes</h2>
<p>Everything is set with <code>data-*</code> attributes on the div. No JavaScript config objects.</p>
<table>
<thead>
<tr>
<th>Attribute</th>
<th>Values</th>
<th>Effect</th>
</tr>
</thead>
<tbody><tr>
<td><code>data-symbols</code></td>
<td><code>AAPL,MSFT,SPY</code></td>
<td>Up to 20 US stocks and ETFs, shown in this order. Omit it to get the largest US companies plus SPY and QQQ.</td>
</tr>
<tr>
<td><code>data-size</code></td>
<td><code>regular</code> (default), <code>compact</code></td>
<td>Regular is 40 px tall with symbol, price and change. Compact is 32 px with symbol and change.</td>
</tr>
<tr>
<td><code>data-theme</code></td>
<td><code>light</code> (default), <code>dark</code>, <code>auto</code></td>
<td><code>auto</code> follows the visitor's system light/dark setting.</td>
</tr>
<tr>
<td><code>data-style</code></td>
<td><code>boxed</code></td>
<td>Rounded border, for a strip inside an article or sidebar. Leave it out for full width.</td>
</tr>
<tr>
<td><code>data-speed</code></td>
<td><code>slow</code>, <code>normal</code> (default), <code>fast</code>, <code>still</code></td>
<td><code>still</code> turns off scrolling; visitors swipe the strip instead.</td>
</tr>
</tbody></table>
<h2>Three layouts that work well</h2>
<h3>1. A full-width strip across the top of every page</h3>
<p>Put the embed right after the opening <code>&lt;body&gt;</code> tag, before your header:</p>
<pre><code class="language-html">&lt;body&gt;
  &lt;div class="ql-tickertape" data-symbols="SPY,QQQ,DIA,IWM,AAPL,MSFT,NVDA,GOOGL,AMZN,META,TSLA"
       data-size="compact" data-theme="auto"&gt;
    Stock quotes by &lt;a href="https://www.quotelinks.com/"&gt;Quotelinks&lt;/a&gt;
  &lt;/div&gt;
  &lt;header&gt;…&lt;/header&gt;
</code></pre>
<p><code>compact</code> plus <code>auto</code> is the least intrusive combination for a site-wide strip: 32 px high, and it matches dark-mode visitors without extra CSS.</p>
<h3>2. A boxed strip inside an article</h3>
<p>When an article discusses a handful of companies, a ticker with just those symbols under the intro gives readers live context:</p>
<pre><code class="language-html">&lt;div class="ql-tickertape" data-symbols="JPM,BAC,WFC,C,GS,MS" data-style="boxed" data-speed="slow"&gt;
  Stock quotes by &lt;a href="https://www.quotelinks.com/"&gt;Quotelinks&lt;/a&gt;
&lt;/div&gt;
</code></pre>
<p><code>slow</code> matters here. A ticker inside body text competes with the words around it, and a slower scroll is easier to read and less distracting.</p>
<h3>3. A static row on a dark dashboard</h3>
<p>For a dashboard or a page where motion would be annoying, turn scrolling off:</p>
<pre><code class="language-html">&lt;div class="ql-tickertape" data-symbols="SPY,QQQ,TLT,GLD,USO" data-theme="dark" data-speed="still"&gt;
  Stock quotes by &lt;a href="https://www.quotelinks.com/"&gt;Quotelinks&lt;/a&gt;
&lt;/div&gt;
</code></pre>
<h2>Using it in React or Next.js</h2>
<p>The script scans the page for <code>.ql-tickertape</code> elements and also watches for new ones added later, which is what single-page apps and page builders need. In React you render the div like any other element and load the script once.</p>
<p><strong>React (Vite, CRA):</strong></p>
<pre><code class="language-jsx">import { useEffect } from "react";

export function TickerTape({ symbols = "AAPL,MSFT,NVDA,SPY" }) {
  useEffect(() =&gt; {
    if (!document.querySelector('script[src*="widgets/tickertape.js"]')) {
      const s = document.createElement("script");
      s.src = "https://www.quotelinks.com/widgets/tickertape.js";
      s.async = true;
      document.body.appendChild(s);
    } else {
      window.qlTickertape?.scan();
    }
  }, [symbols]);

  return (
    &lt;div className="ql-tickertape" data-symbols={symbols} data-theme="auto"&gt;
      Stock quotes by &lt;a href="https://www.quotelinks.com/"&gt;Quotelinks&lt;/a&gt;
    &lt;/div&gt;
  );
}
</code></pre>
<p><strong>Next.js (App Router):</strong></p>
<pre><code class="language-jsx">import Script from "next/script";

export default function Layout({ children }) {
  return (
    &lt;html lang="en"&gt;
      &lt;body&gt;
        &lt;div className="ql-tickertape" data-symbols="SPY,QQQ,AAPL,MSFT,NVDA" data-size="compact"&gt;
          Stock quotes by &lt;a href="https://www.quotelinks.com/"&gt;Quotelinks&lt;/a&gt;
        &lt;/div&gt;
        {children}
        &lt;Script src="https://www.quotelinks.com/widgets/tickertape.js" strategy="afterInteractive" /&gt;
      &lt;/body&gt;
    &lt;/html&gt;
  );
}
</code></pre>
<p>If you change the symbols after the widget has loaded, <code>window.qlTickertape.scan()</code> re-reads the page.</p>
<h2>What to check in any ticker widget</h2>
<p>Whichever widget you use, these are the details that decide whether it helps or hurts your page:</p>
<ul>
<li><strong>Style isolation.</strong> A widget that injects global CSS can break your layout, and your CSS can break it. This one renders inside a Shadow DOM, so neither side leaks into the other.</li>
<li><strong>Off-screen cost.</strong> An animation that keeps running when nobody can see it wastes CPU and battery. This ticker pauses when it scrolls out of view.</li>
<li><strong>Pause control.</strong> Moving text needs a way to stop it. The strip pauses on hover and when it receives keyboard focus.</li>
<li><strong>Reduced motion.</strong> Visitors who set <code>prefers-reduced-motion</code> in their OS get a still strip they can swipe, with no scrolling.</li>
<li><strong>Network behavior.</strong> The script is about 4 KB gzipped, loads async, sets no cookies, and fetches prices once per page view instead of polling.</li>
<li><strong>Honest timestamps.</strong> A ticker should say how fresh its prices are. During market hours the strip shows a delayed "as of" time; after the close it shows the closing date.</li>
</ul>
<h2>Platform notes</h2>
<ul>
<li><strong>WordPress:</strong> a Custom HTML block for one page, or your theme's header area / a header-and-footer plugin for every page.</li>
<li><strong>Blogger:</strong> Layout → Add a Gadget in the header section → HTML/JavaScript.</li>
<li><strong>Squarespace:</strong> a Code block with "Display Source" off.</li>
<li><strong>Ghost:</strong> an HTML card in a post, or after <code>&lt;body&gt;</code> in <code>default.hbs</code> for every page.</li>
<li><strong>Wix:</strong> Embed HTML, stretched to full width, 42 px high (34 px for compact).</li>
<li><strong>Hosts that strip</strong> <code>&lt;script&gt;</code> <strong>from posts</strong> can't run the widget, but the fallback link still shows.</li>
</ul>
<h2>Other embeds in the same style</h2>
<p>The same two-line pattern works for a <a href="https://www.quotelinks.com/widgets/stockcard.html">stock quote card with a one-month chart</a> and for daily market movers; the full set is on the <a href="https://www.quotelinks.com/widgets/">free stock widgets page</a>.</p>
<h2>Terms</h2>
<p>The widgets are free for personal and non-commercial sites, as long as the credit link stays visible. Commercial sites need a written agreement. Prices are for information only and are not investment advice.</p>
<p>If you add the ticker to a project, drop the link in the comments. I'd like to see where it ends up.</p>
]]></content:encoded></item></channel></rss>