On Github snyoz / iconfonts
by Kevin Eulenberg / @snyoz
...und wofür werden sie verwendet?
Wie kann ich sie auf meine Webseite implementieren?
Es gibt 3 Methoden!
@font-face { font-family: IconFont; src: url('font_pfad/icon_font.eot'); src: local('Company Icons'), url('font_pfad/icon-font.eot?#iefix') format('embedded-opentype'), url('font_pfad/icon-font.woff') format('woff'), url('font_pfad/icon-font.ttf') format('truetype'), url('font_pfad/icon-font.svg#fontfile') format('svg'); font-weight: normal; font-style: normal; }
Mark-Up Icon Wrap
HTML Deklaration:
<a href="shopping-cart.php"><span class="icon">s</span> View Cart</a>
CSS Deklaration:
.icon { font-family: 'icon-font'; }
das ist irgendwie blöd und nicht semantisch!
Data-Icon Attribute
HTML Deklaration:
<a href="shopping-cart.php"> <span aria-hidden="true" data-icon="s"></span>View Cart </a>
CSS Deklaration:
[data-icon]:before { font-family: icon-font-name; content: attr(data-icon); speak: none; }
CSS Generated Content
(Empfohlen)
HTML Deklaration:
<a href="shopping-cart.php" class="icon cart">View Cart</a>
CSS Deklaration:
.icon:before { display: inline-block; // oder block font-family: 'icon-font'; font-size: 30px; color: #333; } .cart:before { content:'\e201' }
HTML Deklaration:
<a href="shopping-cart.php" class="icon-cart">View Cart</a>
CSS Deklaration:
[class^="icon-"]:before, [class*=" icon-"]:before { font-family: "fontello"; font-style: normal; font-weight: normal; display: inline-block; } .icon-cart:before { content:'\e101' }