Skip to content

Instantly share code, notes, and snippets.

@leegee
Created December 22, 2017 09:47
Show Gist options
  • Save leegee/791369a3ab089911461a5a5d7032fde3 to your computer and use it in GitHub Desktop.
Save leegee/791369a3ab089911461a5a5d7032fde3 to your computer and use it in GitHub Desktop.
CSS List item bullets with CSS background images
// Where flags.png is a sprite of 25x15 px images
// <nav id="language-selection"><ul><li class='en'>
#language-selection {
margin-left: 2em;
}
#language-selection ul {
list-style-type: none;
margin-left: 0;
padding-left: 0;
}
#language-selection li {
}
#language-selection li:before {
display: inline-block;
width: 25px;
height: 15px;
margin-right: 0.6em;
top: 2px;
position: relative;
content: ' ';
background: url('../assets/flags.png') no-repeat;
}
#language-selection li.en:before {
background-position: -25px 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment