Thuộc tính font-weight trong CSS

Thuộc tính font-weight trong CSS
Thuộc tính font-weight trong CSS

Chức năng của Thuộc tính font-weight trong CSS

Thuộc tính font-weight trong CSS dùng để quy định độ dày mỏng cho văn bản trong phần tử HTML, có nhiều độ dày khác nhau để cho lập trình viên chọn lựa.

Cú pháp của Thuộc tính font-weight trong CSS

font-weight: giatri;

giatri: Giá trị dùng để quy định độ dày mỏng cho văn bản trong phần tử HTML (Ví dụ: bold, 400, 100, 700, ....)

Ví dụ Thuộc tính font-weight trong CSS

font-weight: bold;
font-weight: normal;
font-weight: 100;
font-weight: 200;
font-weight: 300;
font-weight: 400;
font-weight: 500;
font-weight: 600;
font-weight: 700;
font-weight: 800;
font-weight: 900;
font-weight: bolder;
font-weight: lighter;
font-weight: inherit;
font-weight: initial;
font-weight: revert;
font-weight: revert-layer;
font-weight: unset;
<!DOCTYPE html>
<html>
<head>
<title>Chạy thử Ví dụ Thuộc tính font-weight trong CSS</title>
<style>
body {font-family: Arial, Helvetica, sans-serif;}
</style>
</head>
<body>

  <h1>Chạy thử Ví dụ Thuộc tính font-weight trong CSS</h1>
  
  <p>Dùng để quy định độ dày mỏng cho văn bản trong phần tử HTML:</p>
  
  <p style="font-weight: bold;">font-weight: bold;</p>
  
  <p style="font-weight: normal;">font-weight: normal;</p>
  
  <p style="font-weight: 100;">font-weight: 100;</p>
  
  <p style="font-weight: 200;">font-weight: 200;</p>
  
  <p style="font-weight: 300;">font-weight: 300;</p>
  
  <p style="font-weight: 400;">font-weight: 400;</p>
  
  <p style="font-weight: 500;">font-weight: 500;</p>
  
  <p style="font-weight: 600;">font-weight: 600;</p>
  
  <p style="font-weight: 700;">font-weight: 700;</p>
  
  <p style="font-weight: 800;">font-weight: 800;</p>
  
  <p style="font-weight: 900;">font-weight: 900;</p>
  
  <p style="font-weight: bolder;">font-weight: bolder;</p>
  
  <p style="font-weight: lighter;">font-weight: lighter;</p>
  
  <p style="font-weight: inherit;">font-weight: inherit;</p>
  
  <p style="font-weight: initial;">font-weight: initial;</p>
  
  <p style="font-weight: revert;">font-weight: revert;</p>
  
  <p style="font-weight: revert-layer;">font-weight: revert-layer;</p>
  
  <p style="font-weight: unset;">font-weight: unset;</p>
  
</body>
</html>

Chạy Thử

Lời kết

Cảm ơn các bạn đã tham khảo bài viết Thuộc tính font-weight trong CSS.

  • 0 Bình luận
Trần Thị Vân | Content Creator Web Mới
Trần Thị Vân
Trần Thị Vân là Content Creator tại Web Mới, phụ trách nghiên cứu, biên soạn nội dung và chia sẻ kiến thức về website, SEO, lập trình cùng các xu hướng công nghệ
Chia sẻ nội dung đánh giá của bạn về Thuộc tính font-weight trong CSS
Email, Điện thoại của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *
Đánh giá của bạn
Tên *
Email
Số điện thoại *
Bình luận, Hỏi đáp
Đăng ký tư vấn thiết kế website
Tìm hiểu 1 năm không bằng lắng nghe 1 câu tư vấn