CSSطراحی وب

استفاده از فونت های فارسی در طراحی وب با CSS3 و font-face

font-face
.MyClass{
   font-family: 'yekan';
}

برای استفاده از فونت ها در CSS3 می توانیم از font-face استفاده کنیم

در فایل CSS در ابتدای فایل به شکل زیر دستور font-face را می نویسیم:

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

حالا بعنوان مقدار font-family در css از آن استفاده می کنیم.

مثال:

.MyClass{
   font-family: 'yekan';
}

یا:

.MyClass{
   font: bold 12px 'yekan';
}

نظرات