为什么字体样式在外部样式表中不起作用?

时间:2012-10-14 11:53:11

标签: css

我定义并使用我的自定义字体。在内部样式表中,这工作正常但是当我在外部样式表中使用它时它不起作用。
这是我的代码:

@font-face
 {
    font-family: A1Tahoma;
    src: url('Fonts/a1tahoma.eot') format('eot')
         , url('Fonts/a1tahoma.ttf') format('truetype')
         , url('Fonts/a1tahoma.woff') format('woff')
         , url('Fonts/a1tahoma.svg') format('svg'); 


   /* font-weight: normal;
    font-style: normal;*/
} 
  body,.test1 
{

 font-family:A1Tahoma; font-weight: bold;font-style: normal;

}  
<div class="test1">این خط را باید با نوع فونت تاهما ببینید<br />همچنین عدد 125420 به صورت فارسی تایپ شده است.</div>
你能帮帮我吗? enter image description here

3 个答案:

答案 0 :(得分:2)

我怀疑这与样式表中的相对网址有关。外部样式表与html页面位于同一位置吗? url中的路径('Fonts / ...')必须来自CSS的位置。例如,如果您具有以下结构:

index.html
Fonts/a1tahoma.eot
css/styles.css

然后您需要将网址更改为src: url('../Fonts/a1tahoma.eot')

答案 1 :(得分:1)

salam,baraye in kar ghable font ye / bezar yani injori va url ham bedon cot bezar

url(/Fonts/a1tahoma.eot) format('eot')

您可以将此样式用于加载字体

url(/Fonts/a1tahoma.eot) format('eot')

答案 2 :(得分:0)

试试这个:

font-family: 'A1Tahoma';

可能是因为''