Skip to main content

Custom CSS

CSS customization allows you to go beyond the options available in the “Branding” section

nawel avatar
Written by nawel
Updated over a week ago

Introduction

CSS customization allows you to go beyond the options available in the “Branding” section and strengthen the tool’s integration by aligning it perfectly with your brand guidelines.

📝 Note: CSS customization is available on the Advanced and Plus plans.
https://www.loyoly.io/plans


Possibilities

CSS customization offers many possibilities, including:

  • Changing the size of elements

  • Changing colors

  • Changing spacing


Resources to learn CSS


How to integrate your custom CSS

CSS customization is done by importing a file that contains the CSS rules to apply. Below is the procedure to upload this file:

  • Go to the Branding page

  • Click the Edit button on the General appearance card

  • Expand the Custom CSS section

  • Click on the field or blue arrow to open the import window

  • Select your CSS file

  • The file name should appear after closing the import window.

  • Click the Save button so the file is applied.

Note: After saving, changes will be visible in the preview and applied on the front-user interface. A page reload will be necessary to see the changes on the latter.


What to edit and how?

Editing elements is done by writing CSS rules in a file to be imported from the back office.

Find the classes of the element to edit

The first step to edit elements is to find a selector, usually the name of the class applied.

The easiest way is to use your browser’s element inspector. Note that developer mode must be enabled, especially on Safari.

In the screenshot above, we can see that the block containing texts and buttons uses

the classes lds-section-header__wrapper--content and right. We'll use this block for the rest of the document.


Basic principles

To override multiple use cases:

Editing an attribute not used on the front-user

For example, the background color of the previously identified block. Since it doesn’t have an explicit background color, just use the class name as a selector.

cssCopierModifier.lds-section-header__wrapper--content { background-color: white; }

Editing an attribute already used on the front-user

For example, the vertical spacing (gap) between texts and buttons. Intuitively you might write:

cssCopierModifier.lds-section-header__wrapper--content { background-color: white; gap: 60px; }

This change won’t work because the app’s CSS has priority due to the underlying technology. You can see this in the inspector: the gap: 60px property appears crossed out, as the app’s class (identifiable by [data...]) takes precedence.


However, there are two ways to edit this spacing:

1. Be more specific in your rule declaration

Either by combining classes or by defining the hierarchy.

  • In our example, the class is inside a parent div with the class .lds-section__content. To override the app’s CSS, you need to mention this hierarchy. You can use CSS nesting to do so:

cssCopierModifier.lds-section__content { .lds-section-header__wrapper--content { background-color: white; gap: 60px; } }

The 60px gap is applied. This rule takes precedence over the app’s rule.


2. Use !important

The !important flag in CSS forces a property to override other rules. Use it sparingly.

cssCopierModifier.lds-section-header__wrapper--content { background-color: white; gap: 60px !important; }

The 60px gap is applied even though the rule is second in order.


Breakpoints

The front user interface is «responsive»thanks to media queries. The app follows a «mobile first » approach, meaning the base CSS is designed for small screens and larger screen styles override it. Here are the breakpoints used:

Breakpoint

Dimensions (width)

small

≥ 368px

medium

≥ 480px

large

≥ 768px

extra large

≥ 1024px

extra extra large

≥ 1440px


Class names containing [data-XXXXXXXX]

⚠️ Do not use these names to override CSS. The [data-XXXXXXXX] is generated by the technology used to build the front user interface. This number can vary from one version to another and is not reliable.


Customization examples

Mission card – enlarge the icon and spacing


cssCopierModifier.lds-card-challenge { .lds-card-challenge__content { gap: 20px; .lds-image { width: 80px; height: 80px; } } }
Carousels – button and arrow colors

cssCopierModifier.lds-carousel__button { opacity: 1 !important; background-color: yellow !important; .lds-icon { color: red; } }

Reward or VIP cards – zoom on hover

Did this answer your question?