แท็ก <abbr> ใช้สำหรับทำเครื่องหมายคำย่อ (abbreviation) และ acronym (คำย่ออ่านเป็นคำ) ใน HTML5 รวมทั้งสองอย่างไว้ในแท็กเดียวกัน
คุณสมบัติ
- attribute
title- ให้ความหมายเต็มของคำย่อ (tooltip แสดงเมื่อ hover) - Browser บางตัวจะแสดงเส้นจุดใต้คำย่อ
- ช่วย accessibility (screen reader อ่านความหมายเต็ม)
- ช่วย SEO (search engine เข้าใจความหมาย)
ตัวอย่าง
<!DOCTYPE html>
<html>
<head>
<title>HTML abbr tag</title>
</head>
<body>
<h1>Timings</h1>
<p>
We follow <abbr title="Indian Standard Time">IST</abbr> for our webinars.
</p>
<p>
<abbr title="HyperText Markup Language">HTML</abbr> is the standard markup language.
</p>
<p>
<abbr title="National Aeronautics and Space Administration">NASA</abbr> (acronym)
</p>
</body>
</html>
ผลลัพธ์
We follow IST for our webinars.
HTML is the standard markup language.
NASA (acronym)
HTML5 vs HTML4
HTML4 มี <acronym> แยกต่างหาก แต่ HTML5 รวมไว้ใน <abbr> แล้ว