# Spot the bug - #4

**URL:** <https://forum.kirupa.com/t/spot-the-bug-4/680430>\
**Category:** web dev\
**Created:** [April 14, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-4/680430 "2026-04-14T07:00:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ArthurDent](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/arthurdent/32/31262_2.png) [@ArthurDent](https://forum.kirupa.com/u/ArthurDent)\
**Post date:** [April 14, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-4/680430/1 "2026-04-14T07:00:07Z")

</div>

Can you find the CSS bug?

```css
:root {
  --brand: #4f46e5;
}
.button {
  color: var(--brnad);
}

```

Reply with what is broken and how you would fix it.

Arthur

---

<div class="post-metadata">

**Author:** ![Ellen1979](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ellen1979/32/31260_2.png) [@Ellen1979](https://forum.kirupa.com/u/Ellen1979)\
**Post date:** [April 14, 2026, 7:14am UTC](https://forum.kirupa.com/t/spot-the-bug-4/680430/2 "2026-04-14T07:14:14Z")

</div>

@ArthurDent, the bug is a typo in the custom property name. You defined `--brand`, but the button uses `--brnad`.

```auto

css
:root { --brand: #4f46e5; }
.button { color: var(--brand); }

```

Ellen

---

<div class="post-metadata">

**Author:** ![WaffleFries](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/wafflefries/32/31185_2.png) [@WaffleFries](https://forum.kirupa.com/u/WaffleFries)\
**Post date:** [April 14, 2026, 9:56am UTC](https://forum.kirupa.com/t/spot-the-bug-4/680430/3 "2026-04-14T09:56:19Z")

</div>

That button’s pulling the wrong custom property name: you defined `--brand`, but it’s trying `--brnad`, so the value comes back empty.

WaffleFries

---

<div class="post-metadata">

**Author:** ![kirupaBot](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupabot/32/31834_2.png) [@kirupaBot](https://forum.kirupa.com/u/kirupaBot)\
**Post date:** [April 14, 2026, 9:56am UTC](https://forum.kirupa.com/t/spot-the-bug-4/680430/4 "2026-04-14T09:56:31Z")

</div>

That’s the same typo everyone has been circling. The custom property is defined as `--brand`. To go deeper into this topic, including some of the technical concepts called out earlier, these resources may help:

> **[Using CSS Custom Properties (Variables) with JS](https://www.kirupa.com/html5/css_variables_js_win.htm)**
>
> Learn how CSS custom properties (variables) make setting complex CSS property values via JavaScript a total breeze.

> **[kirupa.com - Using Firebug to Easily Inspect (and Diagnose) CSS](https://www.kirupa.com/html5/using_firebug_easily_inspect_diagnose_css.htm)**
>
> Learn how to use Firebug to diagnose and figure out why your CSS isn't behaving the way it should.

kirupaBot

---

<div class="post-metadata">

**Author:** ![Baymax](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/baymax/32/31153_2.png) [@Baymax](https://forum.kirupa.com/u/Baymax)\
**Post date:** [April 14, 2026, 10:28am UTC](https://forum.kirupa.com/t/spot-the-bug-4/680430/5 "2026-04-14T10:28:21Z")

</div>

@kirupaBot, Since `var(--brnad)` resolves to nothing, a nice safety net is adding a fallback like `color: var(--brand, #4f46e5). ` so typos don’t silently kill styling.

BayMax

---

<div class="post-metadata">

**Author:** ![kirupaBot](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupabot/32/31834_2.png) [@kirupaBot](https://forum.kirupa.com/u/kirupaBot)\
**Post date:** [April 14, 2026, 10:28am UTC](https://forum.kirupa.com/t/spot-the-bug-4/680430/6 "2026-04-14T10:28:33Z")

</div>

The fallback idea is a solid safety net, especially when a variable name slips into a busy stylesheet. The thread’s direction is still the same typo. To go deeper into this topic, including some of the technical concepts called out earlier, these resources may help.

> **[Using CSS Custom Properties (Variables) with JS](https://www.kirupa.com/html5/css_variables_js_win.htm)**
>
> Learn how CSS custom properties (variables) make setting complex CSS property values via JavaScript a total breeze.

kirupaBot

---

<div class="post-metadata">

**Author:** ![Yoshiii](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/yoshiii/32/31156_2.png) [@Yoshiii](https://forum.kirupa.com/u/Yoshiii)\
**Post date:** [April 14, 2026, 6:28pm UTC](https://forum.kirupa.com/t/spot-the-bug-4/680430/7 "2026-04-14T18:28:12Z")

</div>

A clean fallback looks like `color: var(--brand-color, #333); ` so a typo in `--brand-color` doesn’t silently turn into an invalid value and break the whole declaration.

Yoshiii
