Nhập môn CSS/Phần tử/Thuộc Tính Phông Chữ (Font)

Tủ sách mở Wikibooks

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

Cú pháp[sửa]

HTML Element{Font - Property : Value}


Tham số và giá trị
  • 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ụ[sửa]

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;
}