Skip to content

Instantly share code, notes, and snippets.

@dguo
Created March 23, 2019 02:42
Show Gist options
  • Save dguo/853abe72698166614eff83a2a414decd to your computer and use it in GitHub Desktop.
Save dguo/853abe72698166614eff83a2a414decd to your computer and use it in GitHub Desktop.
blog - How to Add Copy to Clipboard Buttons to Code Blocks in Hugo - button-styling
.copy-code-button {
color: #272822;
background-color: #FFF;
border-color: #272822;
border: 2px solid;
border-radius: 3px 3px 0px 0px;
/* right-align */
display: block;
margin-left: auto;
margin-right: 0;
margin-bottom: -2px;
padding: 3px 8px;
font-size: 0.8em;
}
.copy-code-button:hover {
cursor: pointer;
background-color: #F2F2F2;
}
.copy-code-button:focus {
/* Avoid an ugly focus outline on click in Chrome,
but darken the button for accessibility.
See https://stackoverflow.com/a/25298082/1481479 */
background-color: #E6E6E6;
outline: 0;
}
.copy-code-button:active {
background-color: #D9D9D9;
}
.highlight pre {
/* Avoid pushing up the copy buttons. */
margin: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment