# How to embed a button into a Topic Post

**URL:** https://meta.discourse.org/t/how-to-embed-a-button-into-a-topic-post/256473
**Category:** Development
**Tags:** css
**Created:** [February 28, 2023, 8:17am UTC](https://meta.discourse.org/t/how-to-embed-a-button-into-a-topic-post/256473 "2023-02-28T08:17:56Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![jrgong](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jrgong](https://meta.discourse.org/u/jrgong)
#### Post date: [September 15, 2025, 3:26pm UTC](https://meta.discourse.org/t/how-to-embed-a-button-into-a-topic-post/256473/6 "2025-09-15T15:26:36Z")

</div>

Quick CSS improvement from our side:

Since the HTML output is slightly different inside a cooked post for “wrap-buttons”, we adjusted the CSS markup since the `a` tag inside the `div > p` hierarchy contains the link and therefore clicking the button slightly above or below the link doesn’t trigger the link.

We managed to work around that to add more padding around the `a` tag and override the `margin-block` markup of the `<p>` tag.

Also, the link color had to be adjusted.

```css
[data-wrap="btn-primary"] {
    display: inline-block;
    align-items: center;
    justify-content: center;
    margin: 0;
    font-weight: normal;
    color: var(--d-button-primary-text-color);
    background-color: var(--d-button-primary-bg-color);
    background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0));
    border-radius: var(--d-button-border-radius);
    transition: var(--d-button-transition);
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0);
    font-size: var(--font-0);
    line-height: normal;
    box-sizing: border-box;
    padding: 0;
    border: var(--d-button-border);
    padding: .5em .65em;
}
[data-wrap="btn-primary"] a,[data-wrap="btn-primary"] a:hover, [data-wrap="btn-primary"] a:active, [data-wrap="btn-primary"] a:visited {
    color: var(--d-button-primary-text-color);
        padding: .5em .65em;
}
[data-wrap="btn-primary"] p {
    margin-block-start: 0;
    margin-block-end: 0;
}

```

---

_[View the full topic](https://meta.discourse.org/t/how-to-embed-a-button-into-a-topic-post/256473)._
