Last active
October 11, 2015 11:18
-
-
Save LucaRosaldi/3851194 to your computer and use it in GitHub Desktop.
CSS: Webfont Icons
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Icon + Text --> | |
<h1> | |
<i data-icon="1" aria-hidden="true"></i> | |
Titolo | |
</h1> | |
<!-- Icon only --> | |
<h1 class="icon-alone"> | |
<i data-icon="1" aria-hidden="true"></i> | |
<span>Titolo</span> | |
</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@font-face { | |
font-family: 'myfont'; | |
src:url('fonts/myfont.eot'); | |
src:url('fonts/myfont.eot?#iefix') format('embedded-opentype'), | |
url('fonts/myfont.svg#myfont') format('svg'), | |
url('fonts/myfont.woff') format('woff'), | |
url('fonts/myfont.ttf') format('truetype'); | |
font-weight: normal; | |
font-style: normal; | |
} | |
i[data-icon] { | |
width: auto; height: auto; | |
line-height: inherit; | |
background: none; | |
background-position: 0 0; | |
background-repeat: repeat; | |
} | |
i[data-icon]:before { | |
content: attr(data-icon); | |
font-family: 'myfont'; | |
font-weight: normal; | |
font-style: normal; | |
text-decoration: inherit; | |
speak: none; | |
-webkit-font-smoothing: antialiased; | |
} | |
.icon-alone, i[data-icon] { | |
@include inline-block('baseline'); | |
} | |
.icon-alone > span { | |
position: absolute; | |
top: -9999px; | |
left: -9999px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment