CSS/Thuộc tính phông chữ (font)

From Wikiversity
< CSS

Chức năng[edit]

Định dạng thuộc tính kiểu chữ Font của phần tử trang mạng

Cú pháp[edit]

Font - Property : Value


Tham số và giá trị[edit]

  • font - family : Arial, Times new romance, ...
Hệ chữ
  • font - size : xx-small |x-small | small| medium| large| x-large| xx-large| smaller| larger| length|%
Cỡ chữ
  • font - stretch : normal| wider| narrower| ultra-condensed| extra-condensed| condensed|semi-condensed|semi-expanded| expanded| extra-expanded| ultra-expanded
  • font - style : normal| italic| oblique
Kiểu chữ
  • font - variant : normal| small-caps
  • font - weight :normal| bold| bolder| lighter| 100| 200| 300| 400| 500| 600| 700| 800| 900
Dạng chữ

Thí dụ[edit]

body {
    font-family: Arial, serif;
    font-size: 10pt;
}

p {
    font-variant: normal;
    font-stretch: ultra-condensed;
}

p.quan-trọng {
    font-style: italic;
}

p.cảnh-báo {
    font-weight: bold;
}