# SOLVED: CSS Sync Automatically Injects Invalid border-width Declaration when Switching Between Elements

**URL:** <https://forum.bricksbuilder.io/t/solved-css-sync-automatically-injects-invalid-border-width-declaration-when-switching-between-elements/40602>\
**Category:** Bugs\
**Tags:** v2-4-3\
**Created:** [October 14, 2026, 6:56am UTC](https://forum.bricksbuilder.io/t/solved-css-sync-automatically-injects-invalid-border-width-declaration-when-switching-between-elements/40602 "2026-10-14T06:56:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![riomastri](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/riomastri/32/9496_2.png) [@riomastri](https://forum.bricksbuilder.io/u/riomastri)\
**Post date:** [October 14, 2026, 6:56am UTC](https://forum.bricksbuilder.io/t/solved-css-sync-automatically-injects-invalid-border-width-declaration-when-switching-between-elements/40602/1 "2026-10-14T06:56:18Z")

</div>

Hi Bricks Team,

I encountered an issue with the CSS Sync feature. When using custom CSS that includes the `border` shorthand with CSS variables alongside specific border properties, switching away to another element and then returning to the original element causes CSS Sync to automatically inject a malformed `border-width` property at the bottom of the `%root%` block.

**Steps to Reproduce:**

1. Add any element (e.g., a Div or Block) and enable CSS Sync (or use a synced workflow between UI controls and Custom CSS).

2. In the element’s **Style \> CSS \> Custom CSS** , paste the following code:

3. Select any other element on the canvas/structure panel.

4. Select the original element again and check the **Custom CSS** box.

**Expected Behavior:** The Custom CSS code should remain exactly as written without unexpected modifications.

**Actual Behavior:** CSS Sync automatically appends an invalid `border-width` declaration at the end of the `%root%` rule:

```auto
%root% {
  display: inline-flex;
  width: fit-content;
  gap: var(--gap-md);
  padding: var(--space-md);
  border: var(--border-1) solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--surface-alt);
  align-items: flex-start;
  border-right-width: solid;
  border-left-width: solid;
  transition: box-shadow var(--duration) var(--ease),
    background-color var(--duration) var(--ease);
  &:hover {
    box-shadow: var(--shadow-section);
    background-color: color-mix(in srgb, var(--primary-lighter) 10%, transparent);
  }
  border-width: var(--border-1) var(--border-1) solid var(--border) var(--border);
}

```

Here is the short-video: [Berrycast - Best video screen recorder for Windows and Mac](https://record.riomastri.com/conversations/ade97fec-2c38-5077-aea9-16a72920422c)

**Environment Info:**

- **Bricks Version:** [2.4.3]

- **Browser:** [Chrome 155]

- **OS:** [Windows 11]

###

---

<div class="post-metadata">

**Author:** ![timmse](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/timmse/32/1192_2.png) [@timmse](https://forum.bricksbuilder.io/u/timmse)\
**Post date:** [October 15, 2026, 1:27pm UTC](https://forum.bricksbuilder.io/t/solved-css-sync-automatically-injects-invalid-border-width-declaration-when-switching-between-elements/40602/3 "2026-10-15T13:27:45Z")

</div>

Hi Rio,  
Thanks for the report. We were able to reproduce the issue and will update this thread once it’s fixed.

---

<div class="post-metadata">

**Author:** ![bricks.assistant](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/bricks.assistant/32/32537_2.png) [@bricks.assistant](https://forum.bricksbuilder.io/u/bricks.assistant)\
**Post date:** [October 28, 2026, 11:46am UTC](https://forum.bricksbuilder.io/t/solved-css-sync-automatically-injects-invalid-border-width-declaration-when-switching-between-elements/40602/4 "2026-10-28T11:46:55Z")

</div>

We’ve addressed this in Bricks 2.4.4, now available as a one-click update in your WordPress Dashboard.

Please read the [changelog entry](https://bricksbuilder.io/release/bricks-2-4-4/) before updating, and let us know if you experience any issues.
