# WIP: Why does Bricks write the same CSS rule multiple times?

**URL:** <https://forum.bricksbuilder.io/t/wip-why-does-bricks-write-the-same-css-rule-multiple-times/10295>\
**Category:** Bugs\
**Created:** [February 24, 2023, 10:14pm UTC](https://forum.bricksbuilder.io/t/wip-why-does-bricks-write-the-same-css-rule-multiple-times/10295 "2023-02-24T22:14:40Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![FranklyCo](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/franklyco/32/9865_2.png) [@FranklyCo](https://forum.bricksbuilder.io/u/FranklyCo)\
**Post date:** [February 24, 2023, 10:14pm UTC](https://forum.bricksbuilder.io/t/wip-why-does-bricks-write-the-same-css-rule-multiple-times/10295/1 "2023-02-24T22:14:40Z")

</div>

Hey Bricks Family!

Over the past few weeks, I’ve noticed that Bricks will sometimes store and serve the exact same CSS rules multiple times. Is this to be expected?

I’m assuming this is due to repeated elements on a page but it seems redundant and wasteful for files being served. Any thoughts on this?

Perhaps I’m missing a setting or documentation details on how to disable this.

 ![bricks-css](https://forum.bricksbuilder.io/uploads/default/original/2X/f/fed9dc4aa3908a46db03b7ee33604fdef40e8b06.png)

---

<div class="post-metadata">

**Author:** ![robertobze](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/robertobze/32/24901_2.png) [@robertobze](https://forum.bricksbuilder.io/u/robertobze)\
**Post date:** [February 25, 2023, 12:20am UTC](https://forum.bricksbuilder.io/t/wip-why-does-bricks-write-the-same-css-rule-multiple-times/10295/2 "2023-02-25T00:20:35Z")

</div>

I noticed the same and wondered too! would like to hear from the devs on this.

---

<div class="post-metadata">

**Author:** ![markballard](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/markballard/32/15663_2.png) [@markballard](https://forum.bricksbuilder.io/u/markballard)\
**Post date:** [February 25, 2023, 2:21am UTC](https://forum.bricksbuilder.io/t/wip-why-does-bricks-write-the-same-css-rule-multiple-times/10295/3 "2023-02-25T02:21:18Z")

</div>

I searched for duplicate css and found this post which sounds like it could be a related issue that they are working on

> [@SOLVED: Echo a template shortcode duplicate all the inline CSS on the page](https://forum.bricksbuilder.io/t/wip-echo-a-template-shortcode-duplicate-all-the-inline-css-on-the-page/6517):
>
> Bricks Version: 1.5.3 Browser: Chrome 90 OS: macOS URL: [https://bricksify.com](https://bricksify.com) I’ve created a custom function in my child theme that echo a template shortcode: echo do\_shortcode('[bricks\_template id="' . esc\_attr($template\_id) . '"]') The problem is it duplicates all the inline CSS generated on the page for each shortcode. So if I have - let say - 5 templates showing on the page - the inline CSS of the whole page will be duplicated 5 times. Here are the style tags created on frontend: \<st…

---

<div class="post-metadata">

**Author:** ![simon](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/s/f07891/32.png) [@simon](https://forum.bricksbuilder.io/u/simon)\
**Post date:** [April 27, 2023, 9:24am UTC](https://forum.bricksbuilder.io/t/wip-why-does-bricks-write-the-same-css-rule-multiple-times/10295/4 "2023-04-27T09:24:16Z")

</div>

I’m seeing exactly the same thing and am wondering if this will be fixed in v1.8.

---

<div class="post-metadata">

**Author:** ![mr.matt.eastwood](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/mr.matt.eastwood/32/3821_2.png) [@mr.matt.eastwood](https://forum.bricksbuilder.io/u/mr.matt.eastwood)\
**Post date:** [April 30, 2023, 6:28pm UTC](https://forum.bricksbuilder.io/t/wip-why-does-bricks-write-the-same-css-rule-multiple-times/10295/5 "2023-04-30T18:28:26Z")

</div>

I’m experiencing the same issue. Using 1.8 beta right now and I’m guessing this is just the first time I’m noticing it, since the issue seems to have been around for a while now.

Also cf. my own thread:

> [@\[DUPLICATE\] Redundant CSS appears numerous times in page source](https://forum.bricksbuilder.io/t/redundant-css-appears-numerous-times-in-page-source/11914):
>
> Browser: Chrome 112.0.5615.165 (Official Build) (64-bit) OS: Linux Mint 21.1 URL: I only have this build on my PC Video: [Redundant CSS in Bricks 1.8 beta - YouTube](https://youtu.be/W2MNThFUdJE) Some classes, when set on an element, end up mentioned several times in the DOM, resulting in redundant CSS. Example: [image] Source HTML: [https://pastebin.com/AAn6JEN4](https://pastebin.com/AAn6JEN4) The same CSS appears in rows 52, 91 and 372. EDIT: I don’t know if this has anything to do with it, but this is what my variable says: --sec-padh-n…

---

<div class="post-metadata">

**Author:** ![thomas](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/thomas/32/3_2.png) [@thomas](https://forum.bricksbuilder.io/u/thomas)\
**Post date:** [May 1, 2023, 12:57pm UTC](https://forum.bricksbuilder.io/t/wip-why-does-bricks-write-the-same-css-rule-multiple-times/10295/6 "2023-05-01T12:57:40Z")

</div>

Hey guys 🙂

I am currently working on the duplicate CSS issue in regard to the “Template” element as mentioned in this thread: [WIP: Echo a template shortcode duplicate all the inline CSS on the page](https://forum.bricksbuilder.io/t/wip-echo-a-template-shortcode-duplicate-all-the-inline-css-on-the-page/6517)

Do you experience the duplicate CSS when rendering a template (either via the shortcode or the Bricks “Template” element)? Or through different setup?

If you could share the live URL of the page the duplicate CSS occurs, that’d be great. Thank you.

---

<div class="post-metadata">

**Author:** ![mr.matt.eastwood](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/mr.matt.eastwood/32/3821_2.png) [@mr.matt.eastwood](https://forum.bricksbuilder.io/u/mr.matt.eastwood)\
**Post date:** [May 1, 2023, 3:55pm UTC](https://forum.bricksbuilder.io/t/wip-why-does-bricks-write-the-same-css-rule-multiple-times/10295/7 "2023-05-01T15:55:34Z")

</div>

Hey Thomas, I’m on my other PC right now (the Porsche ;-)) and I can’t check, but I believe I have a Template element at the bottom of the affected page to pull in my CTA section.

Once I’m back at my main PC where I keep the build, I’ll put it online and send the link here. If you like, I’ll be happy to make you a user account, too.

---

<div class="post-metadata">

**Author:** ![mr.matt.eastwood](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/mr.matt.eastwood/32/3821_2.png) [@mr.matt.eastwood](https://forum.bricksbuilder.io/u/mr.matt.eastwood)\
**Post date:** [May 2, 2023, 8:47am UTC](https://forum.bricksbuilder.io/t/wip-why-does-bricks-write-the-same-css-rule-multiple-times/10295/8 "2023-05-02T08:47:10Z")

</div>

Hey Thomas,

You can see the issue here:

> **[Ihre neue supercoole Website ★ Bezugsfertig aus Saarbrücken!](https://easyweb.2sinn.it/ba/)**
>
> Homepage, 4 Seiten, Blog: Ihre supercoole Website ist bezugsfertig! Modern, sicher und handgefertigt zum Festpreis von Brand Artery aus Saarbrücken.

Best regards,  
Matt.

EDIT: try the hero section.

 ![image](https://forum.bricksbuilder.io/uploads/default/original/2X/3/3714aebfecdce6fb5df42bb367bf3f8c714609d1.png)

---

<div class="post-metadata">

**Author:** ![simon](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/s/f07891/32.png) [@simon](https://forum.bricksbuilder.io/u/simon)\
**Post date:** [May 2, 2023, 11:01am UTC](https://forum.bricksbuilder.io/t/wip-why-does-bricks-write-the-same-css-rule-multiple-times/10295/9 "2023-05-02T11:01:22Z")

</div>

Hi Thomas,

This is happening on any element that has a custom css class.

Inspecting a page, the duplicate css is in that page’s css file. Following the source location links on both the disabled and enabled duplicates shows either multiple ‘BREAKPOINT: Desktop (BASE) \*/’ definitions for the same class, or the source link for the enabled class leads to a totally random location with no definition.

Take a look at this page, currently under development: [Alfington church – Otter Vale Churches](https://ottervalechurches.org/churches/alfington-church/)

Look at the second section with the class o-church-location and you’ll see duplicate css on a custom class that simply adds a coloured background (o-bg-pale-1a).

Within that section there is a div with a shortcode that has a class o-leaflet-map. There is duplicate css here too. However, the leaflet map stuff that has no custom styling doesn’t have duplicate css.

If you then look at the next section with the class o-officers, there is duplicate css. Then drill down to the second container (ul) with the class o-officers-grid and there is duplicate css there. Each li also has duplicate css.

Finally, drill down through the section o-aand-f and any element that has a custom class on it has duplicate css including images.

Hope this helps.

---

<div class="post-metadata">

**Author:** ![simon](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/s/f07891/32.png) [@simon](https://forum.bricksbuilder.io/u/simon)\
**Post date:** [May 2, 2023, 1:17pm UTC](https://forum.bricksbuilder.io/t/wip-why-does-bricks-write-the-same-css-rule-multiple-times/10295/10 "2023-05-02T13:17:59Z")

</div>

OK, this gets more weird. I just created a new page and added my page template (via the template element) for the hero banner, then added a couple of sections and content. In one of the sections I put an image that I styled temporarily at the ID level for a quick look, setting HTML tag to picture, object fit to cover, and caption type to no caption. Having saved the page I inspected it and on both the picture and image there is duplicated css. Looking at the source links, the disabled css is in the new page’s CSS file whilst the enabled CSS is in the page template’s css file. This is different to what I described in the previous post where the css is in the page’s css file.  
The link to the page is [Care for creation – Otter Vale Churches](https://ottervalechurches.org/connect/care-for-creation/). Check out the second section after the template and then drill down to the picture.

---

<div class="post-metadata">

**Author:** ![thomas](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/thomas/32/3_2.png) [@thomas](https://forum.bricksbuilder.io/u/thomas)\
**Post date:** [May 3, 2023, 9:18am UTC](https://forum.bricksbuilder.io/t/wip-why-does-bricks-write-the-same-css-rule-multiple-times/10295/11 "2023-05-03T09:18:19Z")

</div>

Thank you very much. I can replicate & confirm the **duplicated global class CSS**. We are working on a fix 🙂

---

<div class="post-metadata">

**Author:** ![Laurent](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/laurent/32/1697_2.png) [@Laurent](https://forum.bricksbuilder.io/u/Laurent)\
**Post date:** [June 16, 2023, 4:50pm UTC](https://forum.bricksbuilder.io/t/wip-why-does-bricks-write-the-same-css-rule-multiple-times/10295/12 "2023-06-16T16:50:03Z")

</div>

Hi, same problem here with all custom CSS : [https://igs.wa47.fr/](https://igs.wa47.fr/)

---

<div class="post-metadata">

**Author:** ![marcosvl](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/marcosvl/32/5511_2.png) [@marcosvl](https://forum.bricksbuilder.io/u/marcosvl)\
**Post date:** [June 21, 2023, 8:19am UTC](https://forum.bricksbuilder.io/t/wip-why-does-bricks-write-the-same-css-rule-multiple-times/10295/13 "2023-06-21T08:19:16Z")

</div>

This is causing, when editing on the canvas, that if you want to modify a previously saved value, the changes are not reflected in the visual editor.

---

<div class="post-metadata">

**Author:** ![gabrieluntura](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/gabrieluntura/32/6020_2.png) [@gabrieluntura](https://forum.bricksbuilder.io/u/gabrieluntura)\
**Post date:** [October 29, 2024, 2:01am UTC](https://forum.bricksbuilder.io/t/wip-why-does-bricks-write-the-same-css-rule-multiple-times/10295/14 "2024-10-29T02:01:53Z")

</div>

Any updates on this fix? It’s very annoying, and there are styles that I have updated and are not reflected in the builder.

---

<div class="post-metadata">

**Author:** ![olegtix](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/olegtix/32/16006_2.png) [@olegtix](https://forum.bricksbuilder.io/u/olegtix)\
**Post date:** [October 29, 2024, 2:25am UTC](https://forum.bricksbuilder.io/t/wip-why-does-bricks-write-the-same-css-rule-multiple-times/10295/15 "2024-10-29T02:25:51Z")

</div>

Try switching to css file generation in the settings

---

<div class="post-metadata">

**Author:** ![gabrieluntura](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/gabrieluntura/32/6020_2.png) [@gabrieluntura](https://forum.bricksbuilder.io/u/gabrieluntura)\
**Post date:** [October 29, 2024, 2:50am UTC](https://forum.bricksbuilder.io/t/wip-why-does-bricks-write-the-same-css-rule-multiple-times/10295/16 "2024-10-29T02:50:27Z")

</div>

Already tried. Even disabled all plugins installed and it doesn’t fix this.
