Css @即使尝试了我所能想到的一切,字体仍然不起作用
我真的需要Css @即使尝试了我所能想到的一切,字体仍然不起作用,css,fonts,font-face,embedded-fonts,Css,Fonts,Font Face,Embedded Fonts,我真的需要@font-face代码方面的帮助。 它似乎没有看到我的字体文件 我试着改变我能想到的任何东西的路径,创建新文件夹,重命名现有文件夹,将字体文件放在我的根目录中等等 我正在测试Firefox和Chrome 以下是我在CSS中尝试的代码: src: url(http://thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/Univers.ttf); src: url(thefalljourneyin
@font-face
代码方面的帮助。
它似乎没有看到我的字体文件
我试着改变我能想到的任何东西的路径,创建新文件夹,重命名现有文件夹,将字体文件放在我的根目录中等等
我正在测试Firefox和Chrome
以下是我在CSS中尝试的代码:
src: url(http://thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/Univers.ttf);
src: url(thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/Univers.ttf);
src: url(http://www.thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/Univers.ttf);
src: url(www.thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/Univers.ttf);
src: url(/wp-content/themes/thefalltheme/images/Univers.ttf);
src: url(../wp-content/themes/thefalltheme/images/Univers.ttf);
src: url(wp-content/themes/thefalltheme/images/Univers.ttf);
src: url(/thefalltheme/images/Univers.ttf);
src: url(../thefalltheme/images/Univers.ttf);
src: url(thefalltheme/images/Univers.ttf);
src: url(/images/Univers.ttf);
src: url(../images/Univers.ttf);
src: url(images/Univers.ttf);
src: url(www.thefalljourneyindia.iblogger.org/Univers.ttf);
src: url(/Univers.ttf);
src: url(Univers.ttf);
src: url(../Univers.ttf);
你能找出我应该把字体文件放在哪里,或者在我的CSS中做些什么来让它工作吗
(我也在这里和网上其他地方查看了类似的问题,并尝试使用该网站,但没有结果。)
谢谢
更新:
博兹多兹的建议行不通。
我用FontSquirrel来获取字体。
这是CSS:
@font-face{
字体系列:“巷”;
src:url('http://thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/univers-webfont.eot');
src:url('thttp://thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/univers-webfont.eot?#iefix“)格式('embedded-opentype'),
url('http://thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/univers-webfont.woff“)格式(“woff”),
url('http://thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/univers-webfont.ttf“)格式('truetype'),
url('http://thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/univers-webfont.svg#LaneHumouresqueRegular格式('svg');
字体大小:正常;
字体风格:普通;
}
h1{字体大小:110px;
字体系列:“lane”,佐治亚州,衬线;
颜色:#000000;
}
我用“lane”这个名字只是因为bozdoz有它
所有字体都在这里:
http://thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/
他们的名字如下:
univers-webfont.eot、univers-webfont.woof、univers-webfont.ttf、univers-webfont.svg
您希望执行以下操作:
@font-face { font-family: Delicious; src: url('Delicious-Roman.otf'); }
/*
Info
*/
@media screen {
* {
margin: 0px;
padding: 0px;
}
html { background: black url(images/bg.jpg); }
body { font: 14px/1.4 Georgia, serif; }
article, aside, figure, footer, header, nav, section { display: block; }
@font-face {
font-family: 'lane';
src: url('http://thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/univers-webfont.eot');
src: url('thttp://thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/univers-webfont.eot?#iefix') format('embedded-opentype'),
url('http://thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/univers-webfont.woff') format('woff'),
url('http://thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/univers-webfont.ttf') format('truetype'),
url('http://thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/univers-webfont.svg#LaneHumouresqueRegular') format('svg');
font-weight: normal;
font-style: normal;
}
etc.
字体定义文件必须与css文件相关。因此,如果您的css位于:
/Content/css/main.css
那么您的字体必须位于同一文件夹中。如果您指定
@font-face { font-family: Delicious; src: url('fonts/Delicious-Roman.otf'); }
那么您的字体定义将位于
/Content/css/fonts/Delicious-Roman.otf
您可能需要验证服务器是否阻止下载字体。试试这个URL,看看你在给定的URL上得到的是404还是403。你想这样做:
@font-face { font-family: Delicious; src: url('Delicious-Roman.otf'); }
/*
Info
*/
@media screen {
* {
margin: 0px;
padding: 0px;
}
html { background: black url(images/bg.jpg); }
body { font: 14px/1.4 Georgia, serif; }
article, aside, figure, footer, header, nav, section { display: block; }
@font-face {
font-family: 'lane';
src: url('http://thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/univers-webfont.eot');
src: url('thttp://thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/univers-webfont.eot?#iefix') format('embedded-opentype'),
url('http://thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/univers-webfont.woff') format('woff'),
url('http://thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/univers-webfont.ttf') format('truetype'),
url('http://thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/univers-webfont.svg#LaneHumouresqueRegular') format('svg');
font-weight: normal;
font-style: normal;
}
etc.
字体定义文件必须与css文件相关。因此,如果您的css位于:
/Content/css/main.css
那么您的字体必须位于同一文件夹中。如果您指定
@font-face { font-family: Delicious; src: url('fonts/Delicious-Roman.otf'); }
那么您的字体定义将位于
/Content/css/fonts/Delicious-Roman.otf
您可能需要验证服务器是否阻止下载字体。试试这个URL,看看你在给定的URL上得到的是404还是403。你使用的正确吗?这是@font-face的格式。注意文件的数量。您可以使用创建跨浏览器兼容性所需的所有字体。而且,看起来你正在使用WordPress。我相信你必须在WordPress的CSS中使用绝对路径(即列表中的第一个路径)。希望这有帮助
<style>
@font-face {
font-family: 'lane';
src: url('type/lanehum-webfont.eot');
src: url('type/lanehum-webfont.eot?#iefix') format('embedded-opentype'),
url('type/lanehum-webfont.woff') format('woff'),
url('type/lanehum-webfont.ttf') format('truetype'),
url('type/lanehum-webfont.svg#LaneHumouresqueRegular') format('svg');
font-weight: normal;
font-style: normal;
}
.font { font-family:"lane", arial, serif; }
</style>
@字体{
字体系列:“巷”;
src:url('type/lanehum webfont.eot');
src:url('type/lanehum webfont.eot?#iefix')格式('embedded-opentype'),
url('type/lanehum webfont.woff')格式('woff'),
url('type/lanehum webfont.ttf')格式('truetype'),
url('type/lanehum webfont.svg#LaneHumouresqueRegular')格式('svg');
字体大小:正常;
字体风格:普通;
}
.font{font-family:“lane”,arial,serif;}
您是否正确使用了它?这是@font-face的格式。注意文件的数量。您可以使用创建跨浏览器兼容性所需的所有字体。而且,看起来你正在使用WordPress。我相信你必须在WordPress的CSS中使用绝对路径(即列表中的第一个路径)。希望这有帮助
<style>
@font-face {
font-family: 'lane';
src: url('type/lanehum-webfont.eot');
src: url('type/lanehum-webfont.eot?#iefix') format('embedded-opentype'),
url('type/lanehum-webfont.woff') format('woff'),
url('type/lanehum-webfont.ttf') format('truetype'),
url('type/lanehum-webfont.svg#LaneHumouresqueRegular') format('svg');
font-weight: normal;
font-style: normal;
}
.font { font-family:"lane", arial, serif; }
</style>
@字体{
字体系列:“巷”;
src:url('type/lanehum webfont.eot');
src:url('type/lanehum webfont.eot?#iefix')格式('embedded-opentype'),
url('type/lanehum webfont.woff')格式('woff'),
url('type/lanehum webfont.ttf')格式('truetype'),
url('type/lanehum webfont.svg#LaneHumouresqueRegular')格式('svg');
字体大小:正常;
字体风格:普通;
}
.font{font-family:“lane”,arial,serif;}
您应该试试generator,他们的脚本已经过大量测试,并且与许多浏览器兼容。生成字体时选择高级设置。某些浏览器可能无法使用ttf
作为字体,因此它们为您提供eot
woff
和ttf
您应该试试生成器,它们的脚本已经过大量测试,并且与许多浏览器兼容。生成字体时选择高级设置。某些浏览器可能无法使用ttf
作为字体,因此它们为您提供eot
woff
和ttf
我的评论建议作为答案:
尝试使用引号:
url(“Univers.ttf”);
检查是否有字体系列,否则无法在代码中使用字体:
字体系列:“MyFontName”;
您将在css中使用的自定义字体系列,如:
p{font系列:“MyFontName”,Arial,无衬线;}
我从评论中的建议作为答案:
尝试使用引号:
url(“Univers.ttf”);
检查是否有字体系列,否则无法在代码中使用字体:
字体系列:“MyFontName”;
您将在css中使用的自定义字体系列,如:
p{font系列:“MyFontName”,Arial,无衬线;}
首先,感谢大家的大力帮助!
@font-face
代码没有问题。
问题在于我的整体CSS。
你看,我的CSS是这样写的:
@font-face { font-family: Delicious; src: url('Delicious-Roman.otf'); }
/*
Info
*/
@media screen {
* {
margin: 0px;
padding: 0px;
}
html { background: black url(images/bg.jpg); }
body { font: 14px/1.4 Georgia, serif; }
article, aside, figure, footer, header, nav, section { display: block; }
@font-face {
font-family: 'lane';
src: url('http://thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/univers-webfont.eot');
src: url('thttp://thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/univers-webfont.eot?#iefix') format('embedded-opentype'),
url('http://thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/univers-webfont.woff') format('woff'),
url('http://thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/univers-webfont.ttf') format('truetype'),
url('http://thefalljourneyindia.iblogger.org/wp-content/themes/thefalltheme/images/univers-webfont.svg#LaneHumouresqueRegular') format('svg');
font-weight: normal;
font-style: normal;
}
etc.
问题是