Skip to content

Instantly share code, notes, and snippets.

@pmallory
Created February 8, 2012 20:50
Show Gist options
  • Save pmallory/1773658 to your computer and use it in GitHub Desktop.
Save pmallory/1773658 to your computer and use it in GitHub Desktop.
CSS to add line numbers to embedded gists
/* gist formatting */
.line {
background-color: #f1fafb;
}
.gist-highlight {
border-left: 3ex solid #eee;
position: relative;
}
.gist-highlight pre {
counter-reset: linenumbers;
}
.gist-highlight pre div:before {
color: #aaa;
content: counter(linenumbers);
counter-increment: linenumbers;
left: -3ex;
position: absolute;
text-align: right;
width: 2.5ex;
}
@pmallory
Copy link
Author

pmallory commented Feb 8, 2012

added the .line{} section in order to customize the background color of the gist's body. Every line of code in the gist is inside of a div class="line"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment