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

direction-attribute

Skill này làm gì

Skill này kiểm tra xem trang web có đặt đúng chiều văn bản cho ngôn ngữ của mình hay không. Skill dành cho lập trình viên xây website bằng ngôn ngữ từ phải sang trái hoặc có nội dung trộn chiều.

Khi nào nên dùng

  • ✓Khi website của bạn thêm nội dung tiếng Ả Rập, tiếng Do Thái, tiếng Ba Tư hoặc tiếng Urdu.
  • ✓Khi tên người dùng hoặc bình luận trộn văn bản trái sang phải và phải sang trái.
  • ✓Khi menu và bố cục trông ngược với người đọc từ phải sang trái.

Liên kết skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/direction-attribute/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/direction-attribute/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 website của tôi để đảm bảo hiển thị đúng cho người đọc tiếng Ả Rập không?”

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

Cách hoạt động

Agent kiểm tra thuộc tính dir trên trang và trên các phần có chiều khác, như bình luận của người dùng. Nó gợi ý thêm giá trị đúng hoặc thẻ cô lập chiều khi cần.

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.

Set text direction for RTL languages

Without proper dir attributes, RTL text displays incorrectly, UI elements appear backwards, and screen readers announce content in the wrong order.

Quick Reference

  • Set dir="rtl" on <html> for Arabic, Hebrew, Persian, Urdu
  • Use dir="auto" for user-generated content
  • Combine with CSS logical properties (inline-start, inline-end)
  • Test UI mirroring for navigation, icons, and layouts
  • Use bidi isolation such as <bdi> for inline mixed-direction user content

Check

Verify that this HTML document uses the appropriate dir attribute to indicate text direction for right-to-left languages like Arabic, Hebrew, or mixed content. Check user-generated inline text for dir="auto" or bidi isolation where names, handles, or snippets mix writing directions.

Fix

Add the dir attribute to the html element or specific elements with values 'ltr' (left-to-right), 'rtl' (right-to-left), or 'auto' for automatic detection. Use <bdi> or equivalent bidi isolation for mixed-direction inline content.

Explain

Explain how the dir attribute helps browsers and screen readers properly display and navigate text in different writing directions.

Code Review

Review templates, server-rendered HTML, and shared components that output markup related to Set text direction for RTL languages. Flag exact elements, attributes, and routes where the rendered HTML violates the rule. Inspect user-generated inline content, not only page-level locale wrappers.


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

Rule page: https://frontendchecklist.io/rules/html/direction-attribute

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

Thuộc tính dir làm gì?

Nó cho trình duyệt biết văn bản nên chảy theo chiều nào, từ trái sang phải hoặc từ phải sang trái.

Bidi isolation là gì?

Nó giữ cho văn bản trộn chiều, như một tên viết bằng chữ khác, không làm xáo trộn văn bản xung quanh. Skill gợi ý thẻ bdi cho việc này.

Skill có bao gồm việc lật bố cục không?

Skill gợi ý kiểm tra xem điều hướng, biểu tượng và bố cục có được lật đúng không.

Chi tiết

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

Use when reviewing templates, rendered HTML, or shared components related to Set text direction for RTL languages. Validate the final browser-facing markup, not just the source framework abstraction.

repo: thedaviddias/Front-End-Checklist

Độ phổ biến

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