-1

I have a button copy to clipboard. All code boxes in markdown are displayed with the copy to clipboard button. But if I have a code box with text only, then the button is not needed. .text copy-code-button:none does not work. How can I hide the butten?

The result should be:

```text
This should be the code box without the button
```
This should be a code box without the button
/* Copy to clipboard */
.copy-code-button {
    color: var(--bs-black);
    background-color: var(--bs-gray-200);
    border: 1px solid var(--bs-secondary);
    border-top-right-radius: 4px;
    z-index: 1;
    position: relative;
    display: block;
    margin-bottom: -26px;
    margin-left: auto;
    margin-right: 3px;
    font-size: 0.8em;
}

.copy-code-button:hover {
    cursor: pointer;
    background-color: var(--bs-gray-500);
}

.copy-code-button:active {
    background-color: var(--bs-gray-400);
}

.text copy-code-button {
    display: none !important;
}
```sh
Test
```

The Output is:

enter image description here

1
  • 1
    Did you mean .text .copy-code-button? If that's not it, then we need a proper minimal reproducible example from you first of all.
    – CBroe
    Commented Jul 8 at 10:47

0

Browse other questions tagged or ask your own question.