溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

如何使用CSS3@font-face屬性

發(fā)布時間:2021-09-28 15:58:23 來源:億速云 閱讀:115 作者:iii 欄目:web開發(fā)

本篇內(nèi)容介紹了“如何使用CSS3@font-face屬性”的有關(guān)知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!

代碼如下:

<body>
    <!-- ul.layout>li*5>a[href=#]>i.icon -->
    <!-- Sublime Text 快捷拼寫 -->
    <ul class="layout">
        <li><a href="#"><i class="icon">&#xe601;</i></a></li>
        <li><a href="#"><i class="icon">&#xe600;</i></a></li>
        <li><a href="#"><i class="icon">&#xe602;</i></a></li>
        <li><a href="#"><i class="icon">&#xe603;</i></a></li>
        <li class="last-child"><a href="#"><i class="icon">&#xe604;</i></a></li>
        <div class="clear"></div>
    </ul>
</body>

CSS

代碼如下:

<style>
        * {margin:0; padding:0;}
        body { background-color: #fc0; padding-top: 50px;}
        ul li { list-style: none;}
        a { text-decoration: none;}
        .clear { clear:both;}
        .layout { width:604px; margin:0 auto;}
        .layout li { display: block; float: left; border-right: 1px solid #930808; }
        .layout li.last-child { border-right: none;}
        .layout li a { display: block; width: 120px; height:120px; line-height: 120px; text-align: center; background-color: #f00;}
        .layout li a i { color:#fc0;}
        .layout li a:hover i { color:#fff;}
        @font-face {
            font-family: "icomoon";
            src:url('fonts/icomoon.eot?-9731bi');
                /*&uarr;兼容IE9兼容模式打開IE8及其以下瀏覽器可以顯示;*/
                /*&darr;兼容IE9可以顯示;*/
            src:url("fonts/icomoon.eot?#iefix") format("embedded-opentype"),
                url("fonts/icomoon.woff") format("woff"),
                url("fonts/icomoon.ttf") format("truetype"),
                url("fonts/icomoon.svg") format("svg");
            /*EOT { 微軟開發(fā)用于嵌入網(wǎng)頁中的字體,IE專用字體; }
            **WOFF { Web字體中最佳格式,被W3C推薦; }
            **TTF { 由Microsoft和Apple聯(lián)合開發(fā)的一套字體標(biāo)準(zhǔn),是Mac OS和Win操作系統(tǒng)中最常見的的一種字體; }
            **SVG { 用于SVG字體渲染的一種格式,是由W3C制定的開放標(biāo)準(zhǔn)的圖形格式; }
            */
            font-weight: normal;
            font-style: normal;
        }
        .icon {
            font-family: "icomoon";
            font-style: normal;
            font-weight: normal;
            font-size: 90px;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            /*抗鋸齒屬性*/
        }
</style>

效果圖:

如何使用CSS3@font-face屬性

“如何使用CSS3@font-face屬性”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注億速云網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實用文章!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

css
AI