# Contextual Spacing: Dedicated spacing controls for :first-child elements

**URL:** <https://forum.bricksbuilder.io/t/contextual-spacing-dedicated-spacing-controls-for-first-child-elements/40215>\
**Category:** Feature Requests / Improvements\
**Created:** [September 8, 2026, 3:37am UTC](https://forum.bricksbuilder.io/t/contextual-spacing-dedicated-spacing-controls-for-first-child-elements/40215 "2026-09-08T03:37:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![datgausaigon](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/datgausaigon/32/31116_2.png) [@datgausaigon](https://forum.bricksbuilder.io/u/datgausaigon)\
**Post date:** [September 8, 2026, 3:37am UTC](https://forum.bricksbuilder.io/t/contextual-spacing-dedicated-spacing-controls-for-first-child-elements/40215/1 "2026-09-08T03:37:53Z")

</div>

Hi,

While working with Contextual Spacing in Theme Styles, I noticed an important architectural limitation regarding :first-child elements (specifically unordered lists), as well as a minor CSS generation bug when using unitless “0”. Here is the complete breakdown:

## **1. Test Environment Setup:**

To observe margins and list indentation clearly:

- Created a Section \> Container with a distinct background color (Figure 1).

 ![Screenshot 2026-09-06 142139](https://forum.bricksbuilder.io/uploads/default/original/3X/e/4/e433f5cd9192f32cb3b0076a8521446a1d2d9ddd.png)

- Added a Rich Text element containing an unordered list (…), verified in Visual mode (Figure 2) and Code mode (Figure 3).

 ![Screenshot 2026-09-06 142247](https://forum.bricksbuilder.io/uploads/default/original/3X/6/0/60e5e5a64dcf7bc81866306879aecd62d6a7cc39.png)

 ![Screenshot 2026-09-06 142322](https://forum.bricksbuilder.io/uploads/default/original/3X/b/5/b58409debdd6dc17575b5a38fad51bec885b3c77.png)

## **2. Contextual Spacing Configuration:**

Under Style Manager \> Theme Styles \> CONTEXTUAL SPACING:

- Remove default margins: Checked Unordered list (ul).

- Remove default padding: Checked Unordered list (ul) (Figure 4).

 ![Screenshot 2026-09-06 142513](https://forum.bricksbuilder.io/uploads/default/original/3X/7/5/7584ccd63a7691fc634d003d88513b355ae378b1.png)

- Under ADDITIONAL TARGET ELEMENTS, added a target rule for Unordered list (ul) (Figure 5 + 6).

 ![Screenshot 2026-09-06 142611](https://forum.bricksbuilder.io/uploads/default/original/3X/e/9/e91b5914846195d322d7e4b55f533cee1ef91582.png)

 ![Screenshot 2026-09-06 144905](https://forum.bricksbuilder.io/uploads/default/original/3X/0/a/0a33fffab7daa3e572538408b0f0d36ce4b91524.png)

## **3. Real-world Breakdown: Y-axis is correct, but X-axis is stripped on :first-child**

In a Rich Text element (whether it starts with a single or multiple sequential tags), there is a clear distinction between vertical and horizontal spacing:

**3.1. Vertical Spacing (Y-axis: margin-block-start):**

- Bricks is currently doing this completely right.

- The first child should NOT have top margin (margin-top: 0), preserving clean vertical rhythm without introducing unwanted double spacing against the parent container.

**3.2. Horizontal Spacing (X-axis: padding-inline-start):**

- List indentation is an essential intrinsic property required to display bullet points properly.

- A list MUST have horizontal indentation regardless of whether it is the first, middle, or last element.

**3.3. The Conflict with "_\* + :is(ul)":_**

_- When enabling “Remove default padding”, Bricks outputs global “ul { padding: 0; }”, completely removing the browser’s default 40px indentation._

_- When applying spacing in Additional Target Elements, Bricks couples both Y-axis (margin) and X-axis (padding) into the adjacent sibling selector: ".brxe-text \*_ + :is(ul)".

**Real-world Results:**

- When preceded by a heading or text (e.g. something): The rule matches, applying both Y-axis (2rem) and X-axis (5rem) properly.

- When multiple tags follow each other: The first list has no preceding sibling and fails to match; only subsequent lists match.

- When is the top-level element (:first-child): It has no preceding sibling, so “\* + :is(ul)” refuses to match. The Y-axis having 0 margin is correct, but the X-axis is completely stripped as well! Bullet points stick directly against or overflow the container edge with zero indentation.

 ![image](https://forum.bricksbuilder.io/uploads/default/original/3X/c/9/c91c14067fa3d37def23123c443ed527aa858d30.png)

Code of rich-text:

```xml
<ul>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer placerat enim est, non euismod orci pellentesque vel.</li>
<li>Praesent varius purus elit, et hendrerit purus aliquam vel.</li>
<li>Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</li>
</ul>
----
<p>UL 2</p>
----
<ul>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer placerat enim est, non euismod orci pellentesque vel.</li>
<li>Praesent varius purus elit, et hendrerit purus aliquam vel.</li>
<li>Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</li>
</ul>

```

## **4. Feature Request:**

Provide dedicated controls for :first-child elements in Contextual Spacing:

- **Provide dedicated :first-child controls for Target Elements in Contextual Spacing:**  
Allow users to configure distinct spacing (especially horizontal X-axis padding/indentation) whenever a target element is the first child within any container where Contextual Spacing is applied (Rich Text, Post Content, WooCommerce, or custom containers).

- This allows users to preserve the intentional Y-axis behavior (no unwanted top margin) while explicitly restoring the necessary X-axis indentation (padding-inline-start) for top-level lists, without breaking the adjacent sibling flow logic.

Current solution for me, create Custom CSS:

```css
.brxe-text > :is(ul, ol):first-child {
    margin-block-start: 0;
    margin-block-end: 1em;
    padding-inline-start: 2rem;
    padding-inline-end: 0;
}

```

 ![Screenshot 2026-09-06 201614](https://forum.bricksbuilder.io/uploads/default/original/3X/8/8/889829ff15789af5d7df022f5ce3f5351b320f7f.png)

 ![Screenshot 2026-09-06 201644](https://forum.bricksbuilder.io/uploads/default/original/3X/7/5/75fd64d3851c5175ee3d169c9d98409064c191ad.png)

Related Post: [WIP: Contextual Spacing: The Y-axis vs X-axis Dilemma on :first-child Lists & Feature Request for :first-child Controls (plus minor "0" value bug) - #3 by datgausaigon](https://forum.bricksbuilder.io/t/wip-contextual-spacing-the-y-axis-vs-x-axis-dilemma-on-first-child-lists-feature-request-for-first-child-controls-plus-minor-0-value-bug/40207/3)

Thanks

🐻

---

<div class="post-metadata">

**Author:** ![datgausaigon](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/datgausaigon/32/31116_2.png) [@datgausaigon](https://forum.bricksbuilder.io/u/datgausaigon)\
**Post date:** [November 12, 2026, 12:01am UTC](https://forum.bricksbuilder.io/t/contextual-spacing-dedicated-spacing-controls-for-first-child-elements/40215/2 "2026-11-12T00:01:04Z")

</div>

Hi @timmse , @Matej

I am aware that version 2.5 is coming soon. If possible, please consider this suggested feature. It would provide greater clarity regarding the structure of the HTML content and also serve as a helpful guide for developers.

[![](https://img.youtube.com/vi/X8Brq1epsfk/maxresdefault.jpg "Contextual Spacing in Bricks") ](https://www.youtube.com/watch?v=X8Brq1epsfk)

Thanks.

🐻

---

<div class="post-metadata">

**Author:** ![Matej](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/matej/32/20184_2.png) [@Matej](https://forum.bricksbuilder.io/u/Matej)\
**Post date:** [November 12, 2026, 8:50am UTC](https://forum.bricksbuilder.io/t/contextual-spacing-dedicated-spacing-controls-for-first-child-elements/40215/3 "2026-11-12T08:50:07Z")

</div>

Hey 🐻,

Thanks for following up. I’ve added this to our internal task.

However, It’s unlikely to make it into Bricks 2.5, and we don’t have a confirmed release version for it yet.

Best regards,  
Matej
