0
使用圖標從TTF文件我目前使用<span class="icon-home2"></span>
展現在我的CSS文件圖標:如何使用Unicode
@font-face {
font-family: 'icomoon';
src: url('fonts/icomoon.eot?4r9x8o');
src: url('fonts/icomoon.eot?4r9x8o#iefix') format('embedded-opentype'),
url('fonts/icomoon.ttf?4r9x8o') format('truetype'),
url('fonts/icomoon.woff?4r9x8o') format('woff'),
url('fonts/icomoon.svg?4r9x8o#icomoon') format('svg');
font-weight: normal;
font-style: normal;
}
[class^="icon-"], [class*=" icon-"] {
/* use !important to prevent issues with browser extensions that change fonts */
font-family: 'icomoon' !important;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-home:before {
content: "\e900";
}
現在我有我需要顯示的圖標,在CSS內容的不同要求,使用映射在這裏的Unicode:
.icon-home:before {
content: "\e900";
}
任何人都可以告訴我怎麼做到這一點?
與您的問題無關,但與現代網頁設計工作相關:停止使用所有已棄用,廢棄和r edundant字體格式。使用WOFF,如果*有*支持IE8及以下版本,請使用'eot',然後保留。 WOFF的字節爲字節相當於ttf/otf源字體,所以如果你已經有WOFF,添加ttf/otf是沒有意義的,'eot'已經被棄用,但現在已經過時,因爲MS *官方*不再支持IE8和下面,'svg'多年來還沒有成爲真正的字體格式。始終簡化您的問題:從使用WOFF開始。 –