RebelMouse Talk to Us
How to Use the Styles Element in Layout & Design Tool

RebelMouse makes it easy to build intricate, sleek websites through our Layout & Design Tool. Given the critical importance of site performance when it comes to ranking well in search and retaining audiences, we've optimized how the Styles element works with CSS. Here's an overview of what you need to know.


There are two core ways a Styles element can be set to serve CSS: Lazy Load Enabled and Lazy Load Disabled.

When Lazy Load is enabled in the Properties card, all styles defined are minified, inserted into the page header, and put into use upon the first load of a page. When you minify your code into one style tag that fits into your page header, this helps improve your site's page speed.

For CSS styles that are essential, the Lazy Load checkbox should remain unchecked, and the Styles element should instead be appended in your layout after the initial Styles element that's set to load in the viewport upon first load. If the Styles element has heavy CSS, like backgrounds and animations, it's good for your site's page speed if it's set to load after your users' first screen, once they start scrolling and the content enters their viewport at a later point in time.

Additionally, you can use Jinja in a Styles element, which is helpful if you want to reuse variables via Global Settings. For example, when primary-color is your global variable:

{{context.global_settings['primary-color']}}

Here are some screenshots that show how to reuse a variable from Global Settings in a Styles element:

When using a Styles element, consider the following best practices:

  • A Styles element should be used in your Top Bar for any CSS that repeats on more than two pages. This will minimize the occurrence of bugs that commonly appear when you change code on one page, and forget to make the same changes to other pages that need the same CSS.
  • If different CSS needs to be written for one page only, add another Styles element. This ensures that you minimize the CSS on your pages and avoid loading unnecessary CSS.
  • Your CSS tag should be well formatted. Strategic commenting should help group styles by type. This makes it easier to navigate through the code. For example, here's what an open-and-closed comment should look like:

  • You can select all code in a Styles element and then press Shift + Tab to automatically format your code. You can also use a tool like Unminify to help unpack your minified code.
  • Don't forget to write mobile-first CSS. This helps ensure that unnecessary styles are not loaded on mobile devices.
  • Do not use IDs that are generated by RebelMouse. For example, "id=Section_UTC_0_0_17_0_0_2." Instead, add classes to rows and columns:

A class can be added to any post:

  • All posts with the same design can be styled in a Styles element. This is helpful because if you style one post, and there are four others that should have the same look and feel, the CSS will be duplicated on our server for each of them:

If you have any questions about how to use the Styles element, contact your account manager or email support@rebelmouse.com today.

Build on a Better PlatformReady to See More?
Request a Proposal
The Most Secure CMS of 2022
Featured

The Most Secure CMS of 2022

Why RebelMouse Is the Most Secure CMS on the Web

Delivering a secure, high-performing environment with extreme reliability is essential to all of our clients at RebelMouse. We only use industry-leading, reliable approaches to host our infrastructure. This ensures maximum stability and security for all of our clients’ data. Here are just some of the reasons we’re able to maintain a hard-bodied product that’s flexible, too.

Most websites get hacked. RebelMouse has never been hacked.

Keep reading... Show less
Google Made Major Changes to Its Formula for Page Speed. Here’s What to Do About It in 2022.
Rebel Insights

Google Made Major Changes to Its Formula for Page Speed. Here’s What to Do About It in 2022.

Make sure your site is set up for success in 2022.

In the spring of 2020, Google let the world know that its Core Web Vitals would become the new benchmark for measuring a site's performance in its search results, known as the page experience update. Fast forward to more than a year later in August 2021 when, after much anticipation, Google's page experience update became official.

Since its rollout, developers have felt the impact of how their publishing platforms stack up against the new standard. Important decisions around the architecture of your site can now make or break your site's performance in the eyes of Google.

HTTP Archive, a tracking platform that crawls the web to identify trends and record historical patterns, has revealed how top content management systems (CMS) have weathered the page experience update through the creation of its Core Web Vitals Technology Report. RebelMouse consistently outperforms major CMS platforms on Google's most critical metrics since its rollout and into January 2022:

Luckily, performing well on Core Web Vitals is possible with thoughtful, strategic changes to your site’s codebase. Here's what you need to know and how we can help.

Keep reading... Show less
Build on a Better PlatformReady to See More?
Request a Proposal
Optimizing TikTok Embeds to Reduce CLS Penalties
Rebel Insights

Optimizing TikTok Embeds to Reduce CLS Penalties

TikTok has become one of, if not the most popular social media platform. They're fun, they're fast, and anyone can have fun with them, and we have worked very hard to make it super easy for writers and editors to embed them by simply dropping a link into our Add Media Bar.

Keep reading... Show less
Here’s What You Need to Know About Google’s Big GA4 Announcement
Rebel Insights

Here’s What You Need to Know About Google’s Big GA4 Announcement

The search giant said that it’s nixing Universal Analytics for good

The internet was abuzz last week when Google announced that it’s sunsetting its Universal Analytics offering in favor of Google Analytics 4 (GA4). The search giant will stop processing new hits through Universal Analytics on July 1, 2023 (Universal Analytics 360 properties have until October 1, 2023). The news was a shock for site owners and search marketers alike who were not prepared for such a hard deadline.

In its March 16, 2022 announcement, Google said that “Universal Analytics was built for a generation of online measurement that was anchored in the desktop web, independent sessions and more easily observable data from cookies. This measurement methodology is quickly becoming obsolete.”

By contrast, Google says that “Analytics 4 operates across platforms, does not rely exclusively on cookies and uses an event-based data model to deliver user-centric measurement.” Click here to read Google’s full announcement and overview of the differences between GA4 and Universal Analytics.

Why the GA4 Announcement Is a Big Deal

Keep reading... Show less
Build on a Better PlatformReady to See More?
Request a Proposal