For the complete documentation index, see llms.txt. This page is also available as Markdown.

Custom CSS

If you want to personalize your Shopify store beyond the built-in theme options (tweak colors, change font styles, adjust margins and paddings), you can do so by adding custom CSS code to your theme.

Shopify provides a dedicated Custom CSS section right in the theme editor. The customizations you apply using this section will remain in place even after a theme update, unlike what happens when you customize the theme by directly editing its code.

The Shopify theme editor allows you to add custom CSS to your entire store or specific theme sections.

Add custom CSS to your entire store

These changes affect all pages in your store except for the checkout page.

  1. From your Shopify admin, go to Online Store > Themes.

  2. Find the theme and click Customize to open the theme editor.

  3. On the sidebar of the theme editor, click the Theme settings icon.

  4. Find the Custom CSS section in the list of settings.

  5. Add your code and Save the changes in the theme editor.

Add custom CSS to your entire store in the theme editor

Add custom CSS to a theme section

These changes affect only the section you add them to. Note that if you add custom CSS to a section, the changes will appear in all instances of that section across your theme.

  1. From your Shopify admin, go to Online Store > Themes.

  2. Find the theme and click Customize to open the theme editor.

  3. Find the section where you want to add custom CSS.

  4. Find Custom CSS at the bottom of the sidebar with the section's settings.

  5. Add your code and Save the changes in the theme editor.

Add custom CSS to a theme section in the editor

Custom CSS snippets

Below are the most frequently requested changes and the CSS snippets to implement them.

GENERAL

Add these snippets to the custom CSS for your entire store.

Turn off image zoom on hover

Use it to turn off the image zoom on hover for all sections across the theme.

Reduce cart drawer width on mobile

Use it if you don’t want the cart drawer to take up the entire screen area on mobile.

Applies to the "Related products" blocks on the product page and in the cart drawer. Choose the corresponding class depending on the product card layout.

For horizontal cards:

For vertical cards:

Change Shopify chat widget's layout

Use it if you have Shopify’s chat and its widget overlaps other store elements on mobile. You can move it backward by changing its z-index.

Set custom aspect ratio for "Video" section

Use it to define a custom aspect ratio for the video container in the "Video" section, beyond the available aspect ratio options.

For desktop videos:

For mobile videos:

Add the below snippets to the custom CSS of the header section.

Hide "Account" icon from the header bar

Use it to hide the account login icon from the header bar (on desktop only).

Hide "Cart" icon from the header bar

Use it to hide the cart icon from the header bar on both desktop and mobile.

Change 2-level menu items (Dropdown)

Use it to override the theme's properties, such as font size and color, for the 2-level menu items in the header (dropdown menu type).

Change 3-level menu items (Dropdown)

Use it to override the theme's properties, such as font size and color, for the 3-level menu items in the header (dropdown menu type).

Change 2-level menu items (Mega menu)

Use it to override the theme's properties, such as font size and color, for the 2-level menu items in the header (mega menu type).

Change 3-level menu items (Mega menu)

Use it to override the theme's properties, such as font size and color, for the 3-level menu items in the header (mega menu type).

Change 1-level menu items (Drawer menu)

Use it to override the theme's properties, such as font size and color, for the 1-level menu items in the header (drawer menu type).

Change 2-level menu items (Drawer menu)

Use it to override the theme's properties, such as font size and color, for the 2-level menu items in the header (drawer menu type).

Change 3-level menu items (Drawer menu)

Use it to override the theme's properties, such as font size and color, for the 3-level menu items in the header (drawer menu type).

Disable backdrop blurring

Use it to turn off the blurred background effect when opening the header menu.

PRODUCT CARDS

Add the below snippets to the custom CSS for your entire store.

Hide product prices

Use it to remove prices from all product cards throughout the theme.

Change price font weight

Use it to adjust the font weight for final and compare-at prices on all product cards.

For final price:

For compare-at price:

PRODUCT PAGE

Add the below snippets to the custom CSS of the "Product information" section on the product page.

Change price font weight

Use it to adjust the font weight for final and compare-at prices on the product page.

For final price:

For compare-at price:

Change "Add to cart" button color on hover

Use it to change the "Add to cart" button color on the product page when hovering over it.

Change "Size chart" label position

Use it to position the information drawer label, such as the "Size chart" label, to the right of the option name instead of next to it.

Hide floating "Add to cart" button on mobile

Use it to hide the "Add to cart" button that appears on mobile as you scroll down the product page.

Last updated