How To Use Sub Domain Assets for another Sub Domain

时间:2016-10-19 13:39:51

标签: html css css3 .htaccess font-face

I have Two sub-domains in my Wamp-server

in My Asset.localhost . I have css folder and , in this folder I have style.css file that contains @fontFace like Below Code :

@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;
}

Now I'd like to use this file (style.css) to http://management.localhost/dashbord/index.php

Css codes works as well But Fonts Doesn't work ! Where is My Mistake ?

Thank You...

1 个答案:

答案 0 :(得分:1)

只需在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;
}

因为..指定了其父目录,但您的字体位于其他目录中,因此指定完整路径将解决它