Chuyển đến nội dung
Skillpedia
Giao diện (UI/UX)75k · #2854

font-size

Skill này làm gì

Skill này rà soát cỡ chữ trong CSS của site, đặc biệt cho điện thoại. Skill dành cho lập trình viên và nhà thiết kế muốn chữ dễ đọc với mọi khách truy cập.

Khi nào nên dùng

  • ✓Khi chữ nội dung trên điện thoại quá nhỏ và khách phải phóng to.
  • ✓Khi CSS của bạn dùng kích thước pixel cố định bỏ qua cài đặt văn bản của trình duyệt.
  • ✓Khi bạn kiểm tra site theo hướng dẫn trợ năng về thay đổi kích thước chữ.

Liên kết skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/font-size/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/font-size/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Bạn có thể kiểm tra CSS của tôi để chắc rằng chữ đọc được trên di động không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent tìm các khai báo cỡ chữ và đánh dấu chữ nội dung dưới 16 pixel, hoặc các kích thước bỏ qua cài đặt người dùng. Agent gợi ý các đơn vị tương đối như rem hoặc em.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Use readable font sizes on mobile

Approximately 1 in 3 adults over 65 increases their browser's default font size. Low-vision users who cannot use screen magnifiers rely on browser font size settings as their primary accessibility tool. If font sizes are set in px only, browser font size preferences are ignored entirely. Text smaller than 16px on mobile forces all users to zoom in, breaking the page layout and triggering horizontal scroll. iOS Safari's auto-inflation of sub-12px text causes unintended layout shifts.

Quick Reference

  • Body text should be at least 16px (1rem) on mobile — smaller sizes force users to zoom
  • Avoid font-size values below 12px; iOS Safari ignores values below 12px and auto-inflates them
  • Use rem or em units instead of px so text scales with the user's browser font size preference
  • Never set font-size: 100% on <html> using an override that blocks user scaling — respect the browser default (16px)
  • WCAG 2.1 SC 1.4.4 (Resize Text, Level AA): text must be resizable up to 200% without loss of content or functionality

Check

Find all CSS font-size declarations. Flag: (1) body text or paragraph text set below 16px (or 1rem); (2) any font-size below 12px; (3) font-sizes set in px on <html> or <body> that override the browser default; (4) font-sizes that do not scale proportionally when the browser zoom is set to 200% (test in Chrome DevTools by setting font-size in browser settings or using zoom). Check that text remains readable and layout does not break at 200% zoom.

Fix

(1) Convert pixel font sizes to rem units: divide the pixel value by 16 (the browser default) — e.g., 14px becomes 0.875rem. (2) Set body text to at least 1rem (16px equivalent) on mobile. (3) Replace html { font-size: 10px } (a common reset trick) with html { font-size: 62.5% } or avoid font-size resets entirely — instead use rem values calculated from the actual 16px base. (4) If small text is intentional (captions, footnotes), ensure it is at least 0.75rem (12px) and use font-size: 0.75rem so it scales with user preferences.

Explain

WCAG 2.1 SC 1.4.4 (Resize Text) requires that text can be resized up to 200% without loss of content or functionality, except for captions and images of text. Using px units for font sizes makes text immune to browser font size settings (though not to browser zoom). Using rem or em units allows text to scale with the root font size, which the user can adjust in browser settings — this is the preferred approach. iOS Safari also has a built-in heuristic that inflates text smaller than 12px when the page is displayed in mobile view, which can cause layout inconsistencies.

Code Review

Review stylesheets, component styles, and responsive states related to Use readable font sizes on mobile. Flag exact selectors, declarations, or breakpoints that violate the rule in the rendered UI.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/css/font-size

Câu hỏi thường gặp

Vì sao đơn vị tương đối lại hữu ích?

Chúng co giãn theo cài đặt cỡ chữ của trình duyệt, nên người cần chữ lớn hơn sẽ có được điều đó.

Kích thước nhỏ nhất skill chấp nhận là bao nhiêu?

Skill nói nên tránh cỡ chữ dưới 12 pixel, vì iOS Safari có thể tự phóng to chúng.

Quy tắc trợ năng nào được nhắc đến?

Skill nhắc đến WCAG 1.4.4, yêu cầu chữ có thể được thay đổi kích thước lên 200 phần trăm mà không mất nội dung.

Chi tiết

Mô tả gốc của tác giả

Use when applies to all CSS `font-size` declarations, particularly those using `px` units for body text, UI labels, and navigation. Use when auditing mobile responsiveness and accessibility compliance. Check for `font-size` in media queries targeting small screens.

repo: thedaviddias/Front-End-Checklist

Độ phổ biến

Sao GitHub
75k
Vị trí xếp hạng
#2854
Giấy phép
MIT
Cập nhật
31/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự