Chuyển đến nội dung
Skillpedia
Website và giao diện (frontend)75k · #2999

responsive-units

Skill này làm gì

Skill này rà soát một stylesheet tìm cỡ chữ và chiều rộng bằng pixel cố định, rồi chuyển chúng sang đơn vị tương đối. Skill dành cho lập trình viên front-end muốn bố cục tôn trọng cài đặt người dùng và vừa với nhiều màn hình.

Khi nào nên dùng

  • ✓Khi bạn yêu cầu agent làm stylesheet linh hoạt hơn trên các màn hình khác nhau.
  • ✓Khi người dùng tăng cỡ chữ mặc định nhưng chữ trên website của bạn không đổi.
  • ✓Khi bạn muốn ít breakpoint hơn bằng cách để phần tử tự thích ứng với không gian của chúng.

Liên kết skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/responsive-units/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/responsive-units/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

“Một số khách truy cập tăng cỡ chữ nhưng chữ trên website của tôi không đổi. Bạn có thể chuyển các kích thước pixel cố định trong CSS sang đơn vị tương đối 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 cỡ chữ, chiều rộng và khoảng cách bằng pixel nên thích ứng. Agent chuyển cỡ chữ sang rem, chiều rộng sang phần trăm hoặc bố cục flex và grid, và gợi ý clamp để tiêu đề co giãn mượt.

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 relative units for responsive layouts

Fixed pixel values override user browser preferences, making your site inaccessible to users who increase their default font size (a common accommodation for low vision). Relative units also reduce the number of breakpoints needed — elements naturally adapt to available space rather than requiring explicit overrides at every viewport width.

Quick Reference

  • Use rem for font sizes — it respects user browser font size preferences
  • Use % or flex/grid for widths — they adapt to the parent container
  • Use em for component-relative spacing (padding, border-radius)
  • Use clamp() for fluid typography that scales smoothly between breakpoints

Check

Find all px-based font-size, width, and padding values in this CSS file that should use relative units instead.

Fix

Convert fixed px font sizes to rem equivalents and replace fixed widths with percentage or relative alternatives.

Explain

Explain the difference between rem, em, %, vw, and vh, and when to use each one.

Code Review

Review stylesheets, component styles, and responsive states related to Use relative units for responsive layouts. 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/responsive-units

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

Vì sao rem hữu ích?

Nó dựa trên cỡ chữ mặc định của người dùng, nên chữ phóng to khi họ đổi cài đặt trình duyệt.

Khi nào nên dùng em?

Skill khuyên dùng em cho khoảng cách và góc bo nên co giãn theo thành phần.

clamp làm gì?

Nó cho phép chữ lớn lên mượt mà giữa một kích thước tối thiểu và tối đa khi màn hình thay đổi.

Chi tiết

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

Use when reviewing stylesheets, component styles, and responsive behavior related to Use relative units for responsive layouts. Check the rendered layout across breakpoints and interaction states before proposing a fix.

repo: thedaviddias/Front-End-Checklist

Độ phổ biến

Sao GitHub
75k
Vị trí xếp hạng
#2999
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ự