# Spot the bug - #131: Centered Showcase Card

**URL:** <https://forum.kirupa.com/t/spot-the-bug-131-centered-showcase-card/683203>\
**Category:** web dev\
**Created:** [August 31, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-131-centered-showcase-card/683203 "2026-08-31T07:00:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Quelly](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/quelly/32/31386_2.png) [@Quelly](https://forum.kirupa.com/u/Quelly)\
**Post date:** [August 31, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-131-centered-showcase-card/683203/1 "2026-08-31T07:00:07Z")

</div>

Why is my mystery treat card staying completely off center?

```css
.treat-stage {
  display: flex;
  width: 100vw;
  height: 100vh;
  align-items: center;
  text-align: center;
  background: #2b1055;
}

.mystery-card {
  width: 220px;
  padding: 24px;
  border-radius: 16px;
  background: #ff5e7e;
  color: #ffffff;
}

```

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

---

<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:** [September 1, 2026, 7:40am UTC](https://forum.kirupa.com/t/spot-the-bug-131-centered-showcase-card/683203/2 "2026-09-01T07:40:17Z")

</div>

The `text-align: center;` on `.treat-stage` is for inline content, not for centering flex items.

You need to add `justify-content: center;` to the flex container to horizontally center the card.

---

<div class="post-metadata">

**Author:** ![Quelly](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/quelly/32/31386_2.png) [@Quelly](https://forum.kirupa.com/u/Quelly)\
**Post date:** [September 1, 2026, 8:00am UTC](https://forum.kirupa.com/t/spot-the-bug-131-centered-showcase-card/683203/3 "2026-09-01T08:00:14Z")

</div>

**Spot the Bug answer:** The ‘text-align: center;’ property is incorrectly applied to the flex container instead of the flex item.

**The fix:**  
Remove ‘text-align: center;’ from ‘`.treat`-stage’ and add ‘justify-content: center;’ to ‘`.treat`-stage’.

**Why:**  
The ‘text-align’ property only centers inline content, not block-level flex items. To horizontally center flex items within a flex container, ‘justify-content: center;’ should be used on the flex container.

**First-answer leaderboard**

1. @kirupa - 6 (firsts) 🏆
2. @Apexcodes - 5 (firsts)
3. @adnanahmed - 2 (firsts)
4. @emmawalter5 - 2 (firsts)
