القائمة الرئيسية

الصفحات

شرح css | دورة CSS كاملة | #10 : كيفية تكبير خط في css و كيفية تغيير نوع الخط في css - font-family

 

CSS @ font-face Rule



font Google

ثال

حدد خطًا يسمى "myFirstFont" ، وحدد عنوان URL حيث يمكن العثور عليه:

@font-face {
  font-family: myFirstFont;
  src: url(sansation_light.woff);
}
جربها بنفسك "

المزيد من الأمثلة "جربها بنفسك" أدناه.


التعريف والاستخدام

مع هذه @font-faceالقاعدة ، لم يعد على مصممي الويب استخدام أحد الخطوط "الآمنة للويب" بعد الآن.

في @font-faceالقاعدة ، يجب أولاً تحديد اسم للخط (مثل myFirstFont) ، ثم الإشارة إلى ملف الخط.

لاستخدام الخط لعنصر HTML ، ارجع إلى اسم الخط (myFirstFont) من خلال خاصية font-family:

div {
  font-family: myFirstFont;
}

دعم المتصفح

و @font-faceيتم دعم حكم في الحافة، كروم، فايرفوكس، وسفاري، وأوبرا.

بناء الجملة

@font-face {
  font-properties
}

Font descriptorValuesDescription
font-familynameRequired. Defines the name of the font.
srcURLRequired. Defines the URL(s) where the font should be downloaded from
font-stretchnormal
condensed
ultra-condensed
extra-condensed
semi-condensed
expanded
semi-expanded
extra-expanded
ultra-expanded
Optional. Defines how the font should be stretched. Default value is "normal"
font-stylenormal
italic
oblique
Optional. Defines how the font should be styled. Default value is "normal"
font-weightnormal
bold
100
200
300
400
500
600
700
800
900
Optional. Defines the boldness of the font. Default value is "normal"
unicode-rangeunicode-rangeOptional. Defines the range of unicode characters the font supports. Default value is "U+0-10FFFF"

مزيد من الأمثلة

مثال

يجب إضافة قاعدة @ font-face أخرى تحتوي على واصفات للنص الغامق:

@font-face {
  font-family: myFirstFont;
  src: url(sansation_bold.woff);
  font-weight: bold;
}
جربها بنفسك "

الملف "sansation_bold.woff" هو ملف خط آخر ، يحتوي على الأحرف الغامقة لخط Sansation.

ستستخدم المتصفحات هذا عندما يجب عرض جزء من النص مع مجموعة الخطوط "myFirstFont" بالخط العريض.

بهذه الطريقة يمكنك الحصول على العديد من قواعد @ font-face للخط نفسه.

تعليقات

التنقل السريع