Theme Documentation
  • Welcome
  • Getting Started
    • Liquid
    • Theme Types
    • Initial Setup
  • Core Concepts
    • Settings
    • KJB Settings ID's
    • Objects
    • Page Objects
    • Elements
    • Presets
    • Ownership
  • Building Blocks
    • Structure
    • Layouts
    • Sections
    • Section Types
    • Blocks
  • Theme Requirements
    • Required Pages
    • Theme Info
    • Powered By Branding
  • Theme Styling
    • Cornerstone CSS
    • CSS Variables
    • Custom Site Styles
Powered by GitBook
On this page
  1. Theme Styling

CSS Variables

Cornerstone introduces a new way of handling styles made possible through CSS custom properties.

CSS custom properties are supported in all modern browsers so they create a simple clean way to connect your theme settings directly with your stylesheets.

In the past we were required to serve scss.liquid files to accomplish what we can now pull off in normal css. With our new approach we define all of our CSS variables in a snippet called css-variables.liquid which is included in the of the theme.liquid file.

In this file we define all our custom variables

  :root {
    --color-primary: {{ settings.color_primary }};
    --color-offset: #faf9f7;
    --font-default: {{ settings.font_family }};
    --font-heading: {{ settings.heading_font_family }};
  }

this creates a CSS custom property which is tied to the value from the theme editor. We can access these variables in our .scss files:

background: var(--color-offset);
PreviousCornerstone CSSNextCustom Site Styles

Last updated 5 years ago