django-rest-framework/docs_theme/css/copy-button.css
Shrikant Sudam Giri 055c422b34
Add copy button to code blocks in documentation (#9830)
* Add copy button to code blocks for improved documentation usability

* Add copy button to code blocks for improved documentation usability

* Add copy button to code blocks for improved documentation usability

* Make "Copy" button smaller

---------

Co-authored-by: Bruno Alla <alla.brunoo@gmail.com>
2025-12-15 16:01:37 +00:00

31 lines
677 B
CSS

.copy-block-button {
position: absolute;
top: 6px;
right: 6px;
z-index: 10;
white-space: nowrap; /* Prevent text wrap */
}
/* Ensure the PRE container provides positioning context */
pre {
position: relative;
padding-top: 35px; /* Room for the button */
overflow-x: auto; /* Allow horizontal scrolling */
}
/* Code block scrollable */
pre code {
display: block;
overflow-x: auto;
}
/*
The MkDocs/DRF theme injects a <span> inside buttons and applies
a text color that overrides btn-inverse defaults.
This override is intentionally scoped and limited to color only.
*/
.copy-block-button,
.copy-block-button span {
color: #ffffff !important;
}