首页 > 代码库 > DIV+CSS外部字体引用

DIV+CSS外部字体引用

注意:

  由于各个浏览器兼容问题大家还是少用这个,下面是具体的使用方法和效果截图:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">    <title></title>    <style type="text/css">        *{padding:0px; margin:0px; font-size:50px;}        @font-face { font-family: test; src: url(‘alpha_echo.ttf‘); }         @font-face { font-family: test1; src: url(‘Almendra-Bold.otf‘); }         @font-face { font-family: test2; src: url(‘MFYueHei_Noncommercial-Regular.otf‘); }         @font-face { font-family: test3; src: url(‘Ruthie-Regular-OTF.otf‘); }         p{font-family: "test";}        b{font-family: "test1";}        span{font-family: "test2";}        strong{font-family: "test3";}    </style></head><body>    <p style="font-size:40px">asdfasdfasdf白增飞</p>    <b>adfasdfasdf</b><br />    <span>白增飞 demo Font test</span>    <br />    <strong>baizengfei 白增飞</strong></body></html>

效果如下: