Skip to content

Celebrating our new site: 30% off everything with code , until Dec 1.

Bright Themes

Tables for Ghost

Comparison and rating tables for posts, with yes and no marks, rating badges and a box that scrolls sideways on phones.

  • Works with any Ghost theme

New to Ghost snippets?

Build a card once, save it as a snippet, and add it to any post from the card menu. The tutorial shows each step.

Demo

Feature Basic Standard
Custom domain
Built-in analytics
Chat support
Unlimited posts
Rating Phone A Phone B Phone C
Price Good Mid Bad
Display Mid Good Good
Camera Good Bad Mid
Battery Bad Good Mid
On a phone or in a narrow window, a table too wide to fit scrolls sideways inside its box instead of widening the page.

When to use it

  • A roundup of the tools for a job, comparing price, free plan and key features across your picks.
  • A membership post comparing your free and paid tiers, feature by feature.
  • A product test with a score per category, using Good, Mid and Bad badges for each result.

When not to: For simple data with no marks or badges, a Markdown table in Ghost's Markdown card is enough.

The code

<div class="bt-table-comparison" role="region" aria-label="Plan comparison" tabindex="0">
  <table>
    <thead>
      <tr>
        <th scope="col">Feature</th>
        <th scope="col">Basic</th>
        <th scope="col">Standard</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <th scope="row">Custom domain</th>
        <td><span class="bt-table-yes" role="img" aria-label="Yes"></span></td>
        <td><span class="bt-table-yes" role="img" aria-label="Yes"></span></td>
      </tr>
      <tr>
        <th scope="row">Built-in analytics</th>
        <td><span class="bt-table-no" role="img" aria-label="No"></span></td>
        <td><span class="bt-table-yes" role="img" aria-label="Yes"></span></td>
      </tr>
      <tr>
        <th scope="row">Chat support</th>
        <td><span class="bt-table-no" role="img" aria-label="No"></span></td>
        <td><span class="bt-table-yes" role="img" aria-label="Yes"></span></td>
      </tr>
      <tr>
        <th scope="row">Unlimited posts</th>
        <td><span class="bt-table-no" role="img" aria-label="No"></span></td>
        <td><span class="bt-table-yes" role="img" aria-label="Yes"></span></td>
      </tr>
    </tbody>
  </table>
</div>

<div class="bt-table-comparison" role="region" aria-label="Phone ratings" tabindex="0">
  <table>
    <thead>
      <tr>
        <th scope="col">Rating</th>
        <th scope="col">Phone A</th>
        <th scope="col">Phone B</th>
        <th scope="col">Phone C</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <th scope="row">Price</th>
        <td><span class="bt-table-rating bt-table-rating-good">Good</span></td>
        <td><span class="bt-table-rating bt-table-rating-mid">Mid</span></td>
        <td><span class="bt-table-rating bt-table-rating-bad">Bad</span></td>
      </tr>
      <tr>
        <th scope="row">Display</th>
        <td><span class="bt-table-rating bt-table-rating-mid">Mid</span></td>
        <td><span class="bt-table-rating bt-table-rating-good">Good</span></td>
        <td><span class="bt-table-rating bt-table-rating-good">Good</span></td>
      </tr>
      <tr>
        <th scope="row">Camera</th>
        <td><span class="bt-table-rating bt-table-rating-good">Good</span></td>
        <td><span class="bt-table-rating bt-table-rating-bad">Bad</span></td>
        <td><span class="bt-table-rating bt-table-rating-mid">Mid</span></td>
      </tr>
      <tr>
        <th scope="row">Battery</th>
        <td><span class="bt-table-rating bt-table-rating-bad">Bad</span></td>
        <td><span class="bt-table-rating bt-table-rating-good">Good</span></td>
        <td><span class="bt-table-rating bt-table-rating-mid">Mid</span></td>
      </tr>
    </tbody>
  </table>
</div>

Add it to your site

  1. Copy the CSS and paste it in Settings › Advanced › Code injection › Site headerSettings › Advanced › Code injection › Site header (opens your Ghost Admin in a new tab), between <style> and </style>. Once per site.
  2. In a post, add an HTML card (type /html) and paste the HTML.
  3. Change the example text to your own, then publish or update the post.

Tip

Save the card as a Ghost snippet to add it to any post from the card menu: how Ghost snippets work.

How it works

Each table is a plain HTML <table> inside a <div class="bt-table-comparison">. The wrapper scopes the styles, so the snippet never restyles the other tables on your site, and it scrolls sideways when a table is wider than the screen. It is focusable and labeled, so keyboard and screen reader users can reach and scroll it too; change its aria-label to describe your table.

The first column and the header row use <th>, so screen readers announce the feature and the plan with each cell. Rows are striped and lined in a tint of your theme’s text color, which keeps them visible in light and dark themes. Your theme’s own table styles, such as fonts, borders and header styles, can still apply on top, so check the result on a post in your theme.

Two kinds of marks fill the cells:

  • Yes and no: <span class="bt-table-yes"> and <span class="bt-table-no"> draw a check or a cross in a colored circle. Their aria-label is what screen readers say, and the shape, not only the color, tells them apart.
  • Ratings: <span class="bt-table-rating bt-table-rating-good">, bt-table-rating-mid or bt-table-rating-bad make a badge. The word in the badge carries the meaning; the color only backs it up.

Ghost has no table card, but its Markdown card turns Markdown tables into plain HTML tables your theme styles. Use that for simple data; use this snippet for comparisons that need marks, badges and a scroll box on phones. See how editor cards work in Ghost.

Customize

VariableDefaultWhat it changes
--bt-table-border15% of the text colorThe line under each row.
--bt-table-stripe5% of the text colorThe background of every other row. Set it to transparent to turn the stripes off.
--bt-table-yes#15803dThe circle behind a yes mark (✓).
--bt-table-no#dc2626The circle behind a no mark (✕).
--bt-table-good#15803dThe border and tint of Good badges.
--bt-table-mid#d97706The border and tint of Mid badges.
--bt-table-bad#dc2626The border and tint of Bad badges.
Works with every Ghost theme, including ours. Something not right? Ask us.

All snippets

Launch a better Ghost site

From a solo newsletter to a busy newsroom, there is a theme that fits. No code needed.