# Vertical spacing around (framing) the text block

**URL:** <https://forum.obsidian.md/t/vertical-spacing-around-framing-the-text-block/89566>\
**Category:** Devs: Theme Design & Custom CSS\
**Created:** [October 8, 2024, 7:11am UTC](https://forum.obsidian.md/t/vertical-spacing-around-framing-the-text-block/89566 "2024-10-08T07:11:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![buigui](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/b/b782af/32.png) [@buigui](https://forum.obsidian.md/u/buigui)\
**Post date:** [October 8, 2024, 7:11am UTC](https://forum.obsidian.md/t/vertical-spacing-around-framing-the-text-block/89566/1 "2024-10-08T07:11:33Z")

</div>

First, search the [help docs](https://help.obsidian.md) and this forum. Maybe your question has been answered! The [debugging steps](https://forum.obsidian.md/t/about-the-bug-reports-category/24/11) can help, too. Still stuck? Delete this line and proceed.

### What I’m trying to do

Hello,

I’d like the first and last lines framing a block of text between two headings to have spacing (top and bottom): how do I have to code this, please?

I thought the discussion below had solved my problem, but in fact the vertical spacing effected by the “padding” coding only works on the lines inside the text block, but not on the first or last: is this normal?

> [@How to add paddings in my body text?](https://forum.obsidian.md/t/how-to-add-paddings-in-my-body-text/75292):
>
> First, search the [help docs](https://help.obsidian.md) and this forum. Maybe your question has been answered! The [debugging steps](https://forum.obsidian.md/t/about-the-bug-reports-category/24/11) can help, too. Still stuck? Delete this line and proceed. What I’m trying to do I would kike to add a 5px top and bottom padding to my body text Things I have tried In my obsidian.css file, I have tried codes such as : .cm-s-obsidian { padding-top: 5px; padding-bottom: 5px } or .cm-s-obsidian { padding: 5px 0 5px 0; } Both above codes don’t work. Yet below code works : .cm-s-obsidian {…

Thanks in advance for your replies

### Things I have tried

---

<div class="post-metadata">

**Author:** ![ReaderGuy42](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/r/58f4c7/32.png) [@ReaderGuy42](https://forum.obsidian.md/u/ReaderGuy42)\
**Post date:** [October 8, 2024, 8:35am UTC](https://forum.obsidian.md/t/vertical-spacing-around-framing-the-text-block/89566/2 "2024-10-08T08:35:53Z")

</div>

Could you maybe post a screenshot of which spacing exactly you mean?

---

<div class="post-metadata">

**Author:** ![buigui](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/b/b782af/32.png) [@buigui](https://forum.obsidian.md/u/buigui)\
**Post date:** [October 8, 2024, 9:59pm UTC](https://forum.obsidian.md/t/vertical-spacing-around-framing-the-text-block/89566/3 "2024-10-08T21:59:17Z")

</div>

Yes.

 ![Capture d’écran 2024-10-08 à 23.53.01](https://forum.obsidian.md/uploads/default/original/3X/c/1/c16aceff84ac97cb47c9b5e318effd262121b27f.png)  
 ![Capture d’écran 2024-10-08 à 23.53.10](https://forum.obsidian.md/uploads/default/original/3X/0/2/02ffad0c406bae4ad37de60e4e6f1b49f133c203.png)

---

<div class="post-metadata">

**Author:** ![ReaderGuy42](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/r/58f4c7/32.png) [@ReaderGuy42](https://forum.obsidian.md/u/ReaderGuy42)\
**Post date:** [October 9, 2024, 2:15pm UTC](https://forum.obsidian.md/t/vertical-spacing-around-framing-the-text-block/89566/4 "2024-10-09T14:15:52Z")

</div>

I’m not sure that’s entirely possible to do “programmatically” meaning so that it’d always do the desired formatting automatically.

As far as I can tell the padding you want to exist when unfolded is the same attribute that defines the padding between the closed headers. But please someone say otherwise, I’m not sure this is correct.

In the meantime you can go “low-tech” and just add an empty line after and before headings, combined with this snippet:

```auto
.cm-s-obsidian .cm-line.HyperMD-header {
    padding-top: unset;
}

```

that removes the spacing above headers, and then you can add empty lines, e.g.

![open](https://forum.obsidian.md/uploads/default/original/3X/2/f/2f38baab61b35a5e9186a0a1d608cf1201716a00.png)

![closed](https://forum.obsidian.md/uploads/default/original/3X/f/0/f08c046b4a3b96754af883ffd2f00625835b79c4.png)

---

<div class="post-metadata">

**Author:** ![system](https://forum.obsidian.md/uploads/default/original/3X/b/e/bec35fbd23ab28909bb6bfe62cb32eb82dd34019.png) [@system](https://forum.obsidian.md/u/system)\
**Post date:** [January 7, 2025, 2:16pm UTC](https://forum.obsidian.md/t/vertical-spacing-around-framing-the-text-block/89566/5 "2025-01-07T14:16:19Z")

</div>

Closed on January 7, 2025, 2:16pm UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
