我需要在CSS中使用@ font-face更多细节

时间:2015-12-08 01:10:14

标签: css fonts

我正在尝试使用@ font-face,这就是我的代码:

@font-face{
    font-family: myFont;
    src: url(AccidentalPresidency.ttf);
};

div {
    font-family: myFont;
};

字体未更改为我在http://www.1001freefonts.com/accidental_presidency.font

找到的字体

我在网页上找到了字体链接“AccidentalPresidency.ttf”。

我在最新版本的Chrome中使用Codecademy。我之前从未使用过@ font-face。

2 个答案:

答案 0 :(得分:0)

您是否为所有元素应用了font-family?

尝试:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

    <item android:height="5dp" android:width="5dp" >
        <shape android:shape="rectangle">
            <stroke android:width="3dp"
                android:color="#FF999999"/>
            <solid android:color="#00000000"/>

        </shape>
    </item>
    <item  android:height="3dp" android:width="3dp" android:gravity="center">
        <shape android:shape="oval">
            <solid android:color="@android:color/white"/>
            <size android:width="3dp"
                android:height="3dp"/>
        </shape>
    </item>

</layer-list>

答案 1 :(得分:0)

您需要下载字体并将其保存在项目文件夹中。例如:

@font-face {
    font-family: 'My Font';
    src: url('../css/AccidentalPresidency.ttf');
}

div {
    font-family: 'My Font';
}