Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过字体导入css中的字体_Css_Fonts - Fatal编程技术网

通过字体导入css中的字体

通过字体导入css中的字体,css,fonts,Css,Fonts,字体不工作 这里是CSS代码 @font-face { font-family: 'Soolidium', sans-serif; font-style: normal; src:url(http://localhost/changingCinema/font/Soolidium.ttf) format('truetype'); } heading { float:left; width:100%;

字体不工作

这里是CSS代码

@font-face {
  font-family: 'Soolidium', sans-serif;
  font-style: normal;
  src:url(http://localhost/changingCinema/font/Soolidium.ttf) format('truetype');
}

heading
        {
            float:left;
            width:100%;
            margin-bottom:10px;
            font-size:54px;
            font-family: 'Soolidium', sans-serif;}
这是HTML

<heading>My heading</heading>
我的标题
只有在我的窗口中安装此字体时才能使用,否则无法使用

请快速帮助我,谢谢。

尝试更换:

src:url(http://localhost/changingCinema/font/Soolidium.ttf) format('truetype');
与:


假设您的根目录中有一个名为“font”的文件夹,其中的字体“Soolidium.ttf”位于字体face set font family name中。

@font-face {
  font-family: 'Soolidium';
  font-style: normal;
  src: url('http://localhost/changingCinema/font/Soolidium.ttf') format('truetype'); 
  }
对于所有浏览器支持,您必须提供来自不同字体文件的url。
(.eot/.woff/.ttf/.svg)

首先确保将@font字体放在任何其他样式之前

如果可能,您可能还需要为浏览器支持添加其他规则,如下所示:

@font-face {
    font-family: 'Soolidium', sans-serif;
    src: url('Soolidium.woff2') format('woff2'),
    url('Soolidium.woff') format('woff'),
    url('Soolidium.ttf') format('truetype');
}
并一如既往地检查拼写错误或指向错误路径。
请记住您是从CSS文件调用此文件的,因此需要指向字体文件夹。

您是否尝试使用相对URL?检查开发工具是否已成功加载字体。如何签入cssi无法签入src:URL它不显示任何内容,而显示URL您需要生成所有其他字体:.eot、.woff、,等等。看看字体松鼠生成器。此外,这个问题已经被问了数百万次,如果你还不知道文件结构,你怎么能想出这个问题?你的文件是如何设置的?你在寻找什么?试试这个,生成所有其他字体,然后使用它使用的css代码。并设置文件系统。您使用的是哪种浏览器?
@font-face {
    font-family: 'Soolidium', sans-serif;
    src: url('Soolidium.woff2') format('woff2'),
    url('Soolidium.woff') format('woff'),
    url('Soolidium.ttf') format('truetype');
}