Html 不管我做了什么更改,CSS字体都不起作用

Html 不管我做了什么更改,CSS字体都不起作用,html,css,fonts,Html,Css,Fonts,嗨,我知道关于这个问题有一些话题,但请放心,我一直在寻找解决方案,但我找不到任何解决方案 我已经尽了最大的努力,但还是无法修复 这是我的CSS字体: @font-face { font-family: 'quicksandregular'; src: url('font/quiksand2/quicksand-regular-webfont.eot'); src: url('font/quiksand2/quicksand-regular-webfont.eot?#ief

嗨,我知道关于这个问题有一些话题,但请放心,我一直在寻找解决方案,但我找不到任何解决方案

我已经尽了最大的努力,但还是无法修复

这是我的CSS字体:

@font-face {
    font-family: 'quicksandregular';
    src: url('font/quiksand2/quicksand-regular-webfont.eot');
    src: url('font/quiksand2/quicksand-regular-webfont.eot?#iefix') format('embedded-opentype'),
         url('font/quiksand2/quicksand-regular-webfont.woff2') format('woff2'),
         url('font/quiksand2/quicksand-regular-webfont.woff') format('woff'),
         url('font/quiksand2/quicksand-regular-webfont.ttf') format('truetype'),
         url('font/quiksand2/quicksand-regular-webfont.svg#quicksandregular') format('svg');
    font-weight: normal;
    font-style: normal;
}
这是主体css

body {
    font-size: 12px;
    padding: 0;
    height: 100%;
    width: 100%;
    margin: 0;
    background-color: #f7f2e2;
    font-family: Quicksand;
    letter-spacing: -1px;
    overflow: auto;
    position: absolute;
}
body {
font-size: 12px;
padding: 0;
height: 100%;
width: 100%;
margin:0;
background-color: #f7f2e2;
font-family: quicksandregular;
letter-spacing: -1px;
overflow:auto;
position:absolute;
}
不知何故,字体仍然没有显示在我的网站上。当我在电脑中安装了Quicksand字体时,它确实出现了,但当我删除Quicksand字体时,字体就切换为默认的衬线字体。这不是我真正想要的,因为我希望其他电脑能够显示我使用的字体,即流沙

我检查了字体文件夹是否与我的根文件夹完全相同。据我所知,流沙字体应该显示出来


问题是,我错在哪里?如果有人回复我并在最多1天内回复,我会很高兴。

一切都很好,但您需要更改的是应用的css

这是主体css

body {
    font-size: 12px;
    padding: 0;
    height: 100%;
    width: 100%;
    margin: 0;
    background-color: #f7f2e2;
    font-family: Quicksand;
    letter-spacing: -1px;
    overflow: auto;
    position: absolute;
}
body {
font-size: 12px;
padding: 0;
height: 100%;
width: 100%;
margin:0;
background-color: #f7f2e2;
font-family: quicksandregular;
letter-spacing: -1px;
overflow:auto;
position:absolute;
}

一切都很好,但需要更改的是应用的css

这是主体css

body {
    font-size: 12px;
    padding: 0;
    height: 100%;
    width: 100%;
    margin: 0;
    background-color: #f7f2e2;
    font-family: Quicksand;
    letter-spacing: -1px;
    overflow: auto;
    position: absolute;
}
body {
font-size: 12px;
padding: 0;
height: 100%;
width: 100%;
margin:0;
background-color: #f7f2e2;
font-family: quicksandregular;
letter-spacing: -1px;
overflow:auto;
position:absolute;
}

只需对代码进行以下更改即可

font-family: quicksandregular;

只需对代码进行以下更改即可

font-family: quicksandregular;
您必须将“”和您的字体放入其中。因为这是如何在css中生成的

例如:

font-family: 'quicksandregular';
希望这行得通。

您必须将“”和您的字体放入其中。因为这是如何在css中生成的

例如:

font-family: 'quicksandregular';

希望这能起作用。

在您的
@font-face
中,您已将
font-family
属性声明为
quicksandregular
。因此,您必须在CSS代码中使用
font-family:'quicksandregular'
font-family:quicksandregular

另外,一个好方法是将
@font-face
重命名为QuickSand,并使多个
QuickSand
字体面具有不同的
字体权重
属性,因为这将允许您在如下结构中使用它:

.myRegularText {
  font-family: 'QuickSand';
  font-weight: regular;
}
.myBoldText {
  font-family: 'QuickSand';
  font-weight: bold;
}
我不知道您的文件路径是否有问题,因为我看不到服务器目录的结构,但我们假设以下结构:

<root> /
  style/
    main.css
  font/
    quicksand2/
      <font-files>
/
风格/
main.css
字体/
流沙2/
在这种情况下,您必须使用

@font-face {
  font-family: 'QuickSand';
  src: url('/font/quicksand2/<file-name>');
  // ..
}
@font-face{
字体系列:“流沙”;
src:url('/font/quicksand2/');
// ..
}

@font-face{
// ...
src:url('../font/');
// ...
}

希望对您有所帮助。

在您的
@font-face
中,您已将
字体系列
属性声明为
quicksandregular
。因此,您必须在CSS代码中使用
font-family:'quicksandregular'
font-family:quicksandregular

另外,一个好方法是将
@font-face
重命名为QuickSand,并使多个
QuickSand
字体面具有不同的
字体权重
属性,因为这将允许您在如下结构中使用它:

.myRegularText {
  font-family: 'QuickSand';
  font-weight: regular;
}
.myBoldText {
  font-family: 'QuickSand';
  font-weight: bold;
}
我不知道您的文件路径是否有问题,因为我看不到服务器目录的结构,但我们假设以下结构:

<root> /
  style/
    main.css
  font/
    quicksand2/
      <font-files>
/
风格/
main.css
字体/
流沙2/
在这种情况下,您必须使用

@font-face {
  font-family: 'QuickSand';
  src: url('/font/quicksand2/<file-name>');
  // ..
}
@font-face{
字体系列:“流沙”;
src:url('/font/quicksand2/');
// ..
}

@font-face{
// ...
src:url('../font/');
// ...
}


希望能有所帮助。

使用以下字体:字体系列:“quicksandregular”@LaljiTadhani不,它仍然不工作-(你的意思是要更改body中的名称,对吗?如果是的话,root仍然不起作用folder@LaljiTadhani您好,您的意思是我的文件和文件夹的名称有误吗?请使用以下字体:字体系列:'quicksandregular';@LaljiTadhani否,它仍然不起作用..:-(你的意思是要更改body中的名称,对吗?如果是的话,root仍然不起作用folder@LaljiTadhani您好,您的意思是我的文件和文件夹的名称有误吗?您好,谢谢您的回复,但我担心它会保持不变。您介意看看我的根文件夹吗?它很快就会上载。谢谢您好,Moin,t谢谢你的回复,但恐怕还是原来的。你介意看看我的根文件夹吗?它很快就会上载。谢谢你@Victor,我已经切换了我的[font family:'quicksandregular']和[font family:quicksandregular]即使是大写的Q,但都不起作用。我昨天花了整整一天的时间来弄清楚为什么会这样,但一个都不起作用。我真的希望你能看看我上传到dropbox的根文件夹,下面是链接:谢谢你。我会看一看,希望我能找到问题所在。isHello@Victor,我已经切换了我的[font-family:'quicksandregular']和[font-family:quicksandregular]即使是大写的Q,但都不起作用。我昨天花了一整天的时间弄清楚了怎么回事,但没有一个出来。我真的希望你能看看我上传到dropbox的根文件夹,下面是链接:谢谢你。我会看一看,希望我能找到问题所在。谢谢你@BryanLabuschagner帮助,但我担心代码不起作用。如果您能查看我的根文件夹并查看我的错误,我真的很感激。再次感谢您将@font字体更改为这样。(您将看到字体前的双点划线)字体系列:'quicksandregular';src:url('../font/quiksand2/quicksand regular webfont.eot');src:url('../font/quiksand2/quicksand regular webfont.eot?#iefix')格式('embedded-opentype')、url('../font/quiksand2/quicksand regular webfont.woff2')格式('woff2')、url('../font/quiksand2/quicksand regular webfont.woff')格式('woff')、url('