Skip to main content

How to style blog builder blocks with custom CSS

How the Custom CSS field works in the blog post editor, with the HTML structure and full selector list for every block.

Written by Julia

Every block in the blog post editor has a Custom CSS field: select the block, open the Settings tab, and expand the Advanced group. This article explains how the field works and lists, for every block, the HTML it publishes and the selectors you can target.

How the Custom CSS field works

You can write two kinds of CSS in the field, and you can mix them freely.

1. Plain declarations (no selector). These are applied straight to the block's outer element and override the block's settings. They don't need !important, except on the Steps block (see its note below):

box-shadow: 0 2px 12px rgba(0,0,0,.08);max-width: 720px;

2. Rules with selectors. These target elements inside the block, and they apply to this one block only. They never leak into other blocks or the rest of your page:

a { color: #005bd3; }li::marker { color: #008060; }

Five things to keep in mind:

  • The block's settings are written as inline styles on the elements inside it. If your rule targets the same property and does not seem to apply, add !important. For example li { margin-bottom: 10px !important; } when the list already has an item gap set. Product comparison, Steps and Discount code carry their settings as CSS variables on the outer element, and their built-in stylesheet marks some properties !important, so the same advice applies there.

  • Selector rules are scoped as descendants of the block (.bpe-s-<id> a), so a selector can't target the block's own outer element. Use plain declarations for that.

  • Selector rules affect only the one block you typed them on. To restyle a block type everywhere on your store, add CSS to your theme instead and target its marker class: every block carries one (.bpe-cta, .bpe-faq, .bpe-table and so on, listed per block below).

  • Media queries (@media) and @import are not supported in this field.

  • Pseudo-classes and pseudo-elements work inside selector rules: a:hover, li::marker, p:first-child, tr:nth-child(even).

Text

<p class="bpe-paragraph" style="...">  Your text with <strong>bold</strong>, <em>italic</em>  and <a href="...">links</a></p>

When the text contains lists, tables or several paragraphs, the wrapper is <div class="bpe-paragraph"> instead, and each paragraph inside keeps its own <p>.

Selectors you can use:

  • a - links

  • strong - bold text

  • em - italic text

Style links inside this paragraph:

a { color: #005bd3; text-decoration: underline; }

Headings (H2, H3, H4)

<h2 class="bpe-heading bpe-h2" style="...">Your heading</h2><h3 class="bpe-heading bpe-h3" style="...">Your heading</h3><h4 class="bpe-heading bpe-h4" style="...">Your heading</h4>

Selectors you can use:

  • a - links inside the heading

  • strong - bold text

  • em - italic text

Add an underline rule below the heading, with plain declarations:

border-bottom: 2px solid #e3e3e3;padding-bottom: 8px;

Lists (bullet and numbered)

<ul class="bpe-list bpe-list-ul" style="...">  <li style="...">First item</li></ul><ol class="bpe-list bpe-list-ol" style="...">  <li style="...">First step</li></ol>

Selectors you can use:

  • li - each list item

  • li::marker - the bullet or number in front of each item

  • a - links inside items

Color the bullets or numbers, and space the items out:

li::marker { color: #008060; font-weight: 700; }li { margin-bottom: 10px !important; }

Steps

<ol class="bpe-steps" style="...">  <li class="bpe-step">    <span class="bpe-step-n">1</span>    <div class="bpe-step-body">      <h3 class="bpe-step-title">Step title</h3>      <p class="bpe-step-text">Step description</p>    </div>  </li>  ...</ol>

Selectors you can use:

  • .bpe-step - each step

  • .bpe-step-n - the number

  • .bpe-step-body - the column holding the title and text

  • .bpe-step-title - the step title (when set)

  • .bpe-step-text - the step description (when set)

Square numbers and uppercase titles:

.bpe-step-n { border-radius: 8px; }.bpe-step-title { text-transform: uppercase; }

Note: The title and text colors and sizes are set with !important, so use the controls in the Settings tab first. A custom rule for those properties needs !important too. The same goes for the outer list: its padding, side margins and list style are set with !important, so plain declarations for those need it as well, for example padding: 32px !important;.

Table of contents

<div class="bpe-toc" style="...">  <div class="bpe-toc-title" style="...">Table of contents</div>  <ul class="bpe-toc-list" style="...">    <li class="bpe-toc-item bpe-toc-l2" style="...">      <span class="bpe-toc-num" style="...">1.</span>      <a href="#anchor" style="...">Section heading</a>    </li>    <li class="bpe-toc-item bpe-toc-l3" style="...">...</li>  </ul></div>

Selectors you can use:

  • .bpe-toc-title - the title

  • .bpe-toc-list - the list holding all entries

  • .bpe-toc-item - each entry

  • .bpe-toc-l2 - entries for H2 headings only

  • .bpe-toc-l3 - entries for H3 headings only (indented)

  • .bpe-toc-num - the number in front of an entry (when numbering is on)

  • a - the entry links

Show the entries in two columns:

.bpe-toc-list { column-count: 2; }

Table

<div class="bpe-table-scroll" style="overflow-x: auto">  <table class="bpe-table" style="...">    <thead>      <tr><th style="...">Size</th><th style="...">Price</th></tr>    </thead>    <tbody>      <tr style="..."><td style="...">Small</td><td style="...">$29</td></tr>    </tbody>  </table></div>

Selectors you can use:

  • th - header cells

  • td - body cells

  • tbody tr - body rows

  • a - links inside cells

Uppercase headers and custom zebra stripes:

th { text-transform: uppercase; letter-spacing: .5px; }tbody tr:nth-child(even) { background: #f6f9fc !important; }

Note: Your CSS is attached to the table itself. The .bpe-table-scroll wrapper (which makes wide tables scroll sideways) cannot be targeted from this field.

Blockquote

<blockquote class="bpe-blockquote" style="...">  Your quote text  <span style="...">&mdash; Citation</span></blockquote>

Selectors you can use:

  • a - links inside the quote

  • strong - bold text

  • em - italic text

  • span - the citation line at the bottom (when set)

Style the quote box itself, with plain declarations:

border-left: 6px solid #008060;box-shadow: 0 1px 4px rgba(0,0,0,.06);

Image

<figure class="bpe-image" style="...">  <a href="..." style="...">          <!-- only when a link is set -->    <img src="..." alt="..." style="...">  </a>  <figcaption style="...">Caption</figcaption>   <!-- only when set --></figure>

Selectors you can use:

  • img - the image

  • a - the link wrapping the image (when set)

  • figcaption - the caption (when set)

Round the corners and add a shadow:

img { border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,.15); }

Gallery

<div class="bpe-gallery" data-cols-desktop="3"     data-cols-tablet="2" data-cols-mobile="1" style="...">  <figure class="bpe-gallery-item" style="...">    <a href="...">                    <!-- only when a link is set -->      <img src="..." alt="..." style="...">      <figcaption style="...">Caption</figcaption>    </a>  </figure>  ...</div>

Selectors you can use:

  • .bpe-gallery-item - each cell of the grid

  • img - the images

  • a - the link wrapping a cell (when set)

  • figcaption - captions (when set)

Zoom images slightly on hover:

img { transition: transform .2s; }img:hover { transform: scale(1.03); }

Product gallery

<div class="bpe-gallery bpe-product-gallery" data-cols-desktop="3"     data-cols-tablet="2" data-cols-mobile="1" style="...">  <figure class="bpe-gallery-item" data-product-id="...">    <a href="/products/handle">      <img src="..." alt="..." style="...">    </a>    <a class="bpe-pg-btn" href="/products/handle" style="...">Shop now</a>  </figure>  ...</div>

Selectors you can use:

  • .bpe-gallery-item - each product cell

  • img - the product images

  • .bpe-pg-btn - the button under each product (when button text is set)

Make the buttons uppercase:

.bpe-pg-btn { text-transform: uppercase; letter-spacing: .5px; }

Product comparison

<div class="bpe-compare" style="...">  <table class="bpe-pc-table">    <thead>      <tr>        <th class="bpe-pc-label"></th>        <th class="bpe-pc-product bpe-pc-pick" data-handle="...">          <span class="bpe-pc-badge">Top pick</span>          <a class="bpe-pc-media" href="/products/handle"><img src="..." alt="..."></a>          <a class="bpe-pc-title" href="/products/handle">Product title</a>        </th>      </tr>    </thead>    <tbody>      <tr><th class="bpe-pc-label" scope="row">Material</th><td class="bpe-pc-pick">Cotton</td></tr>      <tr class="bpe-pc-check"><th class="bpe-pc-label" scope="row">Machine wash</th><td class="bpe-pc-pick"><span class="bpe-pc-yes">✓</span></td></tr>    </tbody>    <tfoot>      <tr><th class="bpe-pc-label"></th><td class="bpe-pc-pick"><a class="bpe-pc-btn" href="/products/handle">View product</a></td></tr>    </tfoot>  </table></div>

Selectors you can use:

  • .bpe-pc-table - the table

  • .bpe-pc-label - the row labels on the left

  • .bpe-pc-product - each product's header cell

  • .bpe-pc-pick - every cell in the highlighted product's column

  • .bpe-pc-badge - the badge above the highlighted product

  • .bpe-pc-nobadge - the empty space above the other products, which keeps them aligned with the badge

  • .bpe-pc-media img - the product images

  • .bpe-pc-title - the product titles

  • .bpe-pc-check - the yes/no rows

  • .bpe-pc-yes - the ✓ in yes/no rows

  • .bpe-pc-no - the ✕ in yes/no rows

  • .bpe-pc-btn - the buttons (when button text is set)

Uppercase titles and more spaced-out buttons:

.bpe-pc-title { text-transform: uppercase; }.bpe-pc-btn { letter-spacing: .5px; }

Note: The cell background rules are more specific than this field, so .bpe-pc-pick { background: #eef9f1 !important; } needs !important.

Product details page

<div class="bpe-product-page" data-handle="..." style="...">  <div class="product-layout"><div class="product-card">    <div class="product-card__container">      <div class="product-card__media">        <div class="product-card__main-image">...</div>        <div class="product-card__images">...thumbnails...</div>      </div>      <div class="product-card__details">        <div class="product-card__info">          <div class="product-card__vendor">            <span class="product-card__vendor-text">Vendor</span>          </div>          <h2 class="product-card__title">Product title</h2>          <div class="product-card__price">            $29  <span class="product-card__compare-price">$39</span>          </div>        </div>        <shopify-variant-selector></shopify-variant-selector>        <div class="product-card__buttons">          <button class="product-card__add-button">Add to cart</button>          <button class="product-card__buy-button">Buy now</button>        </div>        <div class="product-card__description">          <span class="product-card__description-text">...</span>        </div>      </div>    </div>  </div></div></div>

Selectors you can use:

  • .product-card - the whole card

  • .product-card__main-image - the main product image

  • .product-card__images - the thumbnail strip

  • .product-card__vendor-text - the vendor line

  • .product-card__title - the product title

  • .product-card__price - the price line

  • .product-card__compare-price - the crossed-out compare price

  • shopify-variant-selector - the variant picker

  • .product-card__add-button - the add to cart button

  • .product-card__buy-button - the buy now button

  • .product-card__description-text - the product description

Add letter spacing to the title:

.product-card__title { letter-spacing: 1px !important; }

Note: This block ships with its own built-in stylesheet, and most colors and sizes have controls in the Settings tab. Use the controls first. Custom rules for this block almost always need !important to beat the built-in stylesheet.

Product link

<div class="bpe-product-link" data-handle="..." style="...">  <div class="product-layout"><div class="product-card">    <div class="product-card__container">      <div class="product-card__media">        <div class="product-card__main-image">...</div>      </div>      <div class="product-card__details">        <div class="product-card__info">          <h2 class="product-card__title">Product title</h2>          <div class="product-card__price">$29</div>        </div>        <a class="product__link" href="...">          <div class="product-card__product-link">View product</div>        </a>      </div>    </div>  </div></div></div>

Selectors you can use:

  • .product-card - the whole card

  • .product-card__main-image - the product image

  • .product-card__title - the product title

  • .product-card__price - the price line

  • .product-card__product-link - the button

Add letter spacing to the button:

.product-card__product-link { letter-spacing: 1px !important; }

Note: Same as the Product details page block: it has a built-in stylesheet, so custom rules almost always need !important.

Image with text

<div class="bpe-imagetext" style="...">  <div class="bpe-it-media" style="...">    <img src="..." alt="..." style="...">  </div>  <div class="bpe-it-text" style="...">    <strong class="bpe-it-lead" style="...">Lead heading</strong>    <div class="bpe-it-body" style="...">      <p>Your text...</p>    </div>    <div class="bpe-it-actions" style="...">   <!-- only with button text -->      <a href="..." style="...">Button</a>    </div>  </div></div>

Selectors you can use:

  • .bpe-it-media - the image column

  • img - the image

  • .bpe-it-text - the text column

  • .bpe-it-lead - the lead heading (when set)

  • .bpe-it-body - the rich text area

  • .bpe-it-body p - paragraphs inside the text

  • .bpe-it-actions a - the button (when button text is set)

Remove the top margin of the first paragraph:

.bpe-it-body p:first-child { margin-top: 0; }

Video

<div class="bpe-video" style="...">  <iframe class="bpe-video-frame" src="https://www.youtube.com/embed/..."          style="..." loading="lazy" allowfullscreen></iframe></div>

Selectors you can use:

  • iframe - the video player frame

Add a shadow around the player (on the block itself, with plain declarations):

box-shadow: 0 2px 12px rgba(0,0,0,.15);

Note: Put shadows and borders on the block itself with plain declarations, not on the iframe. The wrapper crops everything sticking out of the frame, so a shadow on the iframe would be cut off.

Instafeed

<div class="bpe-instafeed" style="...">  <div id="feed-48467" class="instafeed-shopify"></div></div>

Without a feed ID, the inner element is <div id="insta-feed"></div> instead. The feed inside is added by the Instafeed app, so its look is controlled there. Use plain declarations to style the block around it.

Limit the feed width, with plain declarations:

max-width: 720px;

FAQ

<div class="bpe-faq" style="...">  <h2 style="...">Frequently asked questions</h2>  <details class="bpe-faq-item" style="...">    <summary style="...">      <h3 style="...">Question?</h3>      <span class="bpe-faq-icon"></span>    <!-- the +/- icon -->    </summary>    <p class="bpe-faq-answer" style="...">Answer text</p>  </details>  ...</div>

Selectors you can use:

  • h2 - the heading above the items

  • .bpe-faq-item - each question box

  • summary - the clickable question row

  • summary h3 - the question text

  • .bpe-faq-icon - the +/- icon

  • .bpe-faq-answer - the answer text

  • a - links inside answers

Bigger questions and a colored +/- icon:

summary { font-size: 15px !important; }.bpe-faq-icon { color: #008060 !important; }

Pros and cons

<div class="bpe-proscons" style="...">  <div class="bpe-proscons-row" style="...">    <div class="bpe-proscons-col bpe-proscons-pros" style="...">      <div class="bpe-proscons-title" style="...">Pros</div>      <ul class="bpe-proscons-list" style="...">        <li style="...">First advantage</li>      </ul>    </div>    <div class="bpe-proscons-col bpe-proscons-cons" style="...">      ...same structure...    </div>  </div></div>

Selectors you can use:

  • .bpe-proscons-col - both columns

  • .bpe-proscons-pros - the pros column only

  • .bpe-proscons-cons - the cons column only

  • .bpe-proscons-title - the column titles

  • li - each list item

  • li::marker - the bullets

Add a soft shadow to both columns:

.bpe-proscons-col { box-shadow: 0 1px 4px rgba(0,0,0,.06); }

Key takeaways

<div class="bpe-takeaways" style="...">  <div class="bpe-takeaways-title" style="...">Key takeaways</div>  <ul class="bpe-takeaways-list" style="...">    <li style="...">First takeaway</li>  </ul></div>

Selectors you can use:

  • .bpe-takeaways-title - the title

  • .bpe-takeaways-list - the list

  • li - each takeaway

  • li::marker - the bullets

Uppercase title and green bullets:

.bpe-takeaways-title { text-transform: uppercase; letter-spacing: .5px; }li::marker { color: #008060; }

Callout

<div class="bpe-callout" data-variant="Info" style="...">  <span class="bpe-callout-tab" style="...">Expert tip</span>  <div class="bpe-callout-body" style="...">    <p>Your callout text...</p>  </div></div>

Selectors you can use:

  • .bpe-callout-tab - the title ribbon on the top edge

  • .bpe-callout-body - the body text area

  • .bpe-callout-body p - paragraphs inside the body

  • a - links inside the body

Soft shadow on the box (plain declarations) and styled links:

box-shadow: 0 1px 3px rgba(0,0,0,.06);.bpe-callout-body a { color: #005bd3; }

Testimonial

<div class="bpe-testimonial" style="...">  <div class="bpe-testimonial-stars" style="...">&#9733;&#9733;&#9733;&#9733;&#9733;</div>  <div class="bpe-testimonial-quote" style="...">The quote text</div>  <div class="bpe-testimonial-author" style="...">Happy customer</div>  <div class="bpe-testimonial-role" style="...">Store owner</div></div>

Selectors you can use:

  • .bpe-testimonial-stars - the star rating row (when a rating is set)

  • .bpe-testimonial-quote - the quote text

  • .bpe-testimonial-author - the author line (when set)

  • .bpe-testimonial-role - the role line (when set)

Add a decorative opening quote before the text:

.bpe-testimonial-quote::before { content: "\201C"; font-size: 32px; line-height: 0; margin-right: 4px; color: #c9cccf; }

Author

<div class="bpe-author" style="...">  <div class="bpe-au-media"><img src="..." alt="..." style="..."></div>  <div class="bpe-au-text">    <div class="bpe-au-name" style="...">Author name</div>    <div class="bpe-au-role" style="...">Role</div>    <div class="bpe-au-bio" style="...">Short bio</div>    <div class="bpe-au-actions" style="..."><a href="..." style="...">Button</a></div>    <div class="bpe-au-links" style="..."><a href="..." aria-label="...">...icon...</a></div>  </div></div>

Selectors you can use:

  • .bpe-au-media img - the photo

  • .bpe-au-text - the text column

  • .bpe-au-name - the name

  • .bpe-au-role - the role

  • .bpe-au-bio - the bio

  • .bpe-au-actions a - the button (when button text is set)

  • .bpe-au-links a - the social links (when added)

Add letter spacing to the name:

.bpe-au-name { letter-spacing: .5px; }

Call to action

<div class="bpe-cta" style="...">  <h2 style="...">Call to action heading</h2>  <div style="...">    <p>Your call to action text...</p>  </div>  <div class="bpe-cta-actions" style="...">   <!-- only with button text -->    <a href="..." style="...">Shop now</a>  </div></div>

Selectors you can use:

  • h2 - the heading

  • p - paragraphs of the body text

  • .bpe-cta-actions a - the button (when button text is set)

Soft shadow on the card (plain declarations) and an uppercase button:

box-shadow: 0 2px 12px rgba(0,0,0,.08);.bpe-cta-actions a { text-transform: uppercase; letter-spacing: .5px; }

Note: Rules that target h2 apply to the published article. The editor preview may not reflect them, so check the published post.

Discount code

<div class="bpe-discount" style="...">  <div class="bpe-dc-info">    <p class="bpe-dc-heading">Save on your first order</p>    <p class="bpe-dc-note">Use this code at checkout.</p>  </div>  <div class="bpe-dc-action">    <span class="bpe-dc-code">WELCOME10</span>    <button type="button" class="bpe-dc-btn">Copy code</button>  </div></div>

Selectors you can use:

  • .bpe-dc-info - the column holding the heading and text

  • .bpe-dc-heading - the heading (when set)

  • .bpe-dc-note - the text (when set)

  • .bpe-dc-action - the code and button

  • .bpe-dc-code - the code

  • .bpe-dc-btn - the copy button (when button text is set)

Wider code spacing and an uppercase button:

.bpe-dc-code { letter-spacing: 3px; }.bpe-dc-btn { text-transform: uppercase; }

Note: The block is not published until it has a code. The button's colors, size and hover effect are set with !important, so use the controls in the Settings tab first.

Button

<div class="bpe-button" style="...">   <!-- alignment + spacing -->  <a href="..." style="...">Find out the details</a></div>

Selectors you can use:

  • a - the button

  • a:hover - the button on hover

Style the button directly with plain declarations, and set your own hover color:

box-shadow: 0 2px 8px rgba(0,0,0,.2);text-transform: uppercase;a:hover { background: #333333 !important; }

Note: For this block, plain declarations are applied to the button link itself, not the wrapper, so you can style the button directly without any selector. The built-in hover effect uses !important, so your own a:hover rule needs it too.

Body label

<span class="bpe-body" style="...">NEW LABEL</span>

The label is a single element with no children, so plain declarations are all you need:

border: 1px solid #c7ebd4;box-shadow: 0 1px 2px rgba(0,0,0,.08);

Divider

<div class="bpe-divider-wrap" style="...">  <hr class="bpe-divider" style="..."></div>

Selectors you can use:

  • hr - the line itself

Replace the line with a gradient bar:

hr { border-top: 0 !important; height: 3px; background: linear-gradient(90deg, #008060, #95bf47); }

Custom HTML

<div class="bpe-html" style="...">  ...your own HTML, exactly as you wrote it...</div>

Selectors you can use:

  • your own tags and classes - anything you wrote in the HTML field, e.g. .my-box

Target your own classes from the HTML field:

.my-box { padding: 16px; border: 1px solid #e3e3e3; border-radius: 8px; }

Note: This field is the natural place to keep the CSS for markup you paste into the Custom HTML block: the rules stay scoped to this block, so your class names cannot clash with the theme.

Did this answer your question?