Custom CSS

Advanced

We do not support code customizations. This guide offers a basic reference for advanced users familiar with HTML and CSS. Always test code changes on a duplicated, unpublished version of your theme. For assistance, we recommend finding a professional developer through Shopify Experts ↗ or Task Husky ↗.

Understanding CSS basics

Your theme uses Cascading Style Sheets (CSS) to define the appearance and layout of your online store. CSS allows you to apply styles (such as colors, position, or size) to elements of your site (such as headings, images, buttons).

Below, we cover the most basic elements of CSS code used to add custom styles. Understanding these basic elements will help you avoid common code errors.

CSS code uses a simple syntax made up of selectors and declarations. Selectors target which elements to style, while declarations apply desired styles to selected elements. Declarations are always contained within curly braces ({}).

.selector-name {
  property: value;
}

Declarations consist of a property and a value, separated by a colon. The property is the aspect of the element that will be styled, such as the color or font size. The value is the specified setting for the property, such as red, #FF0000, or 12px.

To learn more about using CSS, we recommend consulting resources like MDN Web Docs ↗ and W3 School Tutorials.

Using Custom CSS in theme editor

In the theme editor, you can use the Custom CSS setting to apply styles to elements on your site, without needing to edit any theme code files.

You can add custom CSS to your entire theme (in Theme settings) or to individual sections (in Section settings). We recommend using Custom CSS for minor style changes.

Before adding custom code, always duplicate your current theme and use the unpublished theme copy to test your changes.

To find the selector names used in your theme, you will need to use your browser's Inspector tool ↗. There are some limitations to using selectors. See Shopify's guide on Considerations for using custom CSS ↗.

STEPS

In your Shopify Admin:

  1. Click Duplicate on your current theme.

  2. Click Customize on the duplicated, unpublished theme version.

In your theme editor (Customize):

  1. To apply custom styles to your entire theme, go to Theme settings > Advanced. To apply custom styles to individual sections, click on the Section.

  2. Click to open the Custom CSS tab.

  3. Enter or paste the CSS code into the Custom styles box.

  4. Click Save.

  5. Click Preview to review your changes.

    Use the preview link to further test your changes on multiple browsers and devices.

  6. After testing, you can go to your Theme library to Publish the duplicated theme with your changes.

Using custom.css file

While we recommend using the available Custom CSS settings in the theme editor, Spark includes a custom.css file in the Styles folder.

Always duplicate your current theme before making edits to the code. Use the unpublished version to add and test customizations before publishing your theme.

How's Spark working for you?

We built Spark with developers in mind, and we want to hear from you about what you're building. Please feel free to reach out with questions or introduce yourself by e-mailing us at developers@fluorescent.co

Related links

Edit theme JavaScript Custom JavaScript events Custom Liquid Custom fonts

Last updated