HTML5:  Principle Semantics

HTML5: Principle Semantics

·

1 min read

Demo & Short-Video

https://github.com/KhucHieuNghi/html-principle/tree/main/html-semantic

Center of the problem

Với Headless cấu trúc tổ chức "Elements" với "web-application" rắc rối khi đọc hoặc tìm "Elements" nếu không có attributes( id, classname, data-*).

Phân biệt Elements bằng attributes khó hơn thay vì sử dụng semantics (specifics tag name)

Pros

  • Mô tả ý nghĩa và cấu trúc của nội dung trên trang web.

  • Cải thiện SEO, Accessibility, Search engines ( unverified news )

Cons

  • Chưa quen khi triển khai Semantic HTML

  • Confuse loại semantic HTML khi triển khai hoặc tổ chức Element

Main Principle

  • Semantic HTML không quan trọng. Góc độ Engineer mang tính clean-code

  • Triển khai theo vùng từ cấp cha đến cấp con (hình dưới)

Implementation levels

Level 1: Semantic HTML Cấp cha

Level 2: Semantic HTML đến các Cấp con

Level 3: Semantic HTML các tags đặc biệt

Level 4: Lập rules hoặc conventions cho quy tắc Semantic HTML