web font doesn't get applied! @font-face

半城伤御伤魂 提交于 2019-12-23 01:45:10

问题


I'm struggling with web fonts, I'm using DejavuSans to display Georgia ქართული text.

Unfortunately it doesn't get applied and I'm out of ideas.

@font-face {
    font-family: 'DejaVuSans';
    src: url('font/DejaVuSans.eot');
    src: url('font/DejaVuSans.eot?#iefix') format('embedded-opentype'),
         url('font/DejaVuSans.woff') format('woff'),
         url('font/DejaVuSans.ttf') format('truetype'),
         url('font/DejaVuSans.svg#bolnisiregular') format('svg');
    font-weight: normal;
    font-style: normal;
}

body
{
   font-family: 'DejaVuSans' !important;
}

I downloaded it from here: http://www.fonts2u.com/dejavu-sans.font

And I applied it here: http://mac.idev.ge:800/breakmedia/

Chrome inspector tells me that css is correctly overwritten, but where are the fonts themselves??


回答1:


Urls are relative to the folder containing the css file. So your url to the font needs to be absolute and point to the root e.g:

/font/DejaVuSans.eot

or relative and point to one folder up:

../font/DejaVuSans.eot

etc depending on where your stylesheet and fonts are located.



来源:https://stackoverflow.com/questions/24759286/web-font-doesnt-get-applied-font-face

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!