font-face css3 自定義字體

@font-face {
    font-family:"iconfont";/*本身建立字體的名字*/
    src:url("fonts/iconfont.eot");/*字體的路徑,能夠是絕對路徑也能夠是相對路徑*/
    src:url("fonts/iconfont.eot?#iefix") format("embedded-opentype"),/*format是瀏覽器支持字體的格式*/
        url("fonts/iconfont.woff") format("woff"),
        url("fonts/iconfont.ttf") format("truetype");
    font-weight:normal;
    font-style:normal;
}web

/*下面是一個class引用*/瀏覽器

.iconfont {
    font-family:"iconfont";
    display:inline-block;
    vertical-align:middle;
    line-height:1;
    font-weight:normal;
    font-style:normal;
    speak:none;
    text-decoration:inherit;
    text-transform:none;
    text-rendering:auto;
    -webkit-font-smoothing:antialiased;//讓字體更加清晰
    -moz-osx-font-smoothing:grayscale;//讓字體更加清晰
}字體

相關文章
相關標籤/搜索