Skip to content

Instantly share code, notes, and snippets.

@erbmicha
Created March 1, 2013 17:22
Show Gist options
  • Save erbmicha/5066232 to your computer and use it in GitHub Desktop.
Save erbmicha/5066232 to your computer and use it in GitHub Desktop.
CSS using background-origin to keep background-image tied to content
/* lined paper example */
line-height: 1.2;
background-image: linear-gradient(rgba(0,0,0,.3) 1px, transparent 1px);
background-size: 100% 1.2em;
background-position: 0 .8em;
background-origin: content-box;
padding: 1em;
/* code editor example */
line-height: 1.5;
background-image: linear-gradient(beige 50%, white 50%);
background-size: 100% 3em;
background-origin: content-box;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment