我的 Wamp 服务器中有两个子域
在我的 Asset.localhost 中。我有 css 文件夹,在这个文件夹中我有 style.css 文件,其中包含 @fontFace 如下代码:
@font-face {
font-family: 'yekan';
src: url('../fonts/Yekan-modified.eot');
src: url('../fonts/Yekan-modified.eot#iefix') format('embedded-opentype'),
url('../fonts/Yekan-modified.woff') format('woff'),
url('../fonts/Yekan-modified.ttf') format('truetype'),
url('../fonts/Yekan-modified.svg#CartoGothicStdBook') format('svg');
font-weight: normal;
font-style: normal;
}
- 我的字体文件夹路径是http://asset.localhost/admin/fonts/[MYFONTS]
- 我的 css 文件夹路径是 http://asset.localhost/admin/css/style.css
现在我想将此文件(style.css) 用于http://management.localhost/dashbord/index.php
CSS 代码也可以,但字体不起作用! 我的错误在哪里?
谢谢...
最佳答案
只需在您的 css 文件中指定完整的字体路径
@font-face {
font-family: 'yekan';
src: url('http://asset.localhost/admin/fonts/Yekan-modified.eot');
src: url('http://asset.localhost/admin/fonts/Yekan-modified.eot#iefix') format('embedded-opentype'),
url('http://asset.localhost/admin/fontsYekan-modified.woff') format('woff'),
url('http://asset.localhost/admin/fontsYekan-modified.ttf') format('truetype'),
url('http://asset.localhost/admin/fontsYekan-modified.svg#CartoGothicStdBook') format('svg');
font-weight: normal;
font-style: normal;
}
因为 ..
指定了它的父目录,但是你的字体在其他目录中,所以指定完整路径将解决它
关于html - 如何将子域 Assets 用于另一个子域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40133046/