ရိုးရိုးလေး ရှင်းပြမယ်
ရိုးရိုးလေး ရှင်းရရင်
သူငယ်ချင်းကို စကားပြောတဲ့အခါ "မီးဖိုကို မထိနဲ့!" လို့ အလေးအနက် ပြောတာနဲ့ "ငါ အဲဒီ စကား မပြောခဲ့ဘူး" ဆိုပြီး စကားလုံးတစ်လုံးကို ဖိပြောတာ မတူပါဘူး။ HTML မှာလည်း ဒီလို ကွာခြားချက်တွေကို tag တွေနဲ့ ဖော်ပြပါတယ်: အရေးကြီးတာကို <strong>၊ ဖိပြောတာကို <em> နဲ့ ရေးပါတယ်။
<b> နဲ့ <i> ကတော့ အရေးမကြီးပေမယ့် ထင်ရှားစေချင်တဲ့ စာသား (product name လို) နဲ့ အသံ ပြောင်းဖတ်ရမယ့် စာသား (သိပ္ပံအမည်၊ နိုင်ငံခြားစကားလုံး) အတွက်ပါ။ Browser က လေးခုလုံးကို bold ဒါမှမဟုတ် italic အဖြစ်ပဲ ပြပေမယ့် နောက်ကွယ်က အဓိပ္ပာယ်တွေ မတူပါဘူး။
Problem → Why → Solution
ပြဿနာ: ပုံစံအတွက် tag ရွေးလိုက်တာ
Online shop တစ်ခုမှာ developer က bold လိုချင်တိုင်း ကြုံရာ tag ကို သုံးခဲ့ပါတယ်: ဈေးနှုန်းကို <strong>၊ ဘေးကင်းရေး သတိပေးချက်ကို <b> နဲ့ ရေးထားပါတယ်။ နောက်ပိုင်း designer က သတိပေးချက်တွေ အနီရောင် ဖြစ်စေဖို့ strong { color: #b00020; } ဆိုတဲ့ CSS rule တစ်ကြောင်း ထည့်လိုက်ပါတယ်။ ရလဒ်က ဈေးနှုန်းတိုင်း အနီရောင် ဖြစ်သွားပြီး သတိပေးချက် အစစ်ကတော့ အနက်ရောင်အတိုင်း ကျန်နေပါတယ်။
<p>Electric kettle, 1.7 litres. Price: <strong>$25</strong></p>
<p><b>Do not</b> open the lid while the water is boiling.</p>
<p><i>New:</i> free delivery this week.</p>ဘာကြောင့် ဒီလို ဖြစ်ရတာလဲ
Tag တွေကို အဓိပ္ပာယ်အလိုက် မဟုတ်ဘဲ ပုံစံအလိုက် ရွေးခဲ့လို့ပါ။ CSS, screen reader, reader mode, ဘာသာပြန် tool တွေက tag ရဲ့ အဓိပ္ပာယ်ကို ယုံပြီး အလုပ်လုပ်ကြပါတယ်။ "အရေးကြီးတဲ့ စာ" ကို style ပြောင်းတဲ့ rule က ဈေးနှုန်းကို ထိမိပြီး သတိပေးချက်ကို မထိမိတာက markup ကြောင့်ပါ။ Tag ကို အဓိပ္ပာယ်အလိုက် ရွေးထားရင် style ကို နောက်မှ ဘယ်လိုပဲ ပြောင်းပြောင်း ဘေးကင်းပါတယ်။
Core concept: ပုံစံ တူပေမယ့် အဓိပ္ပာယ် မတူ
<strong> က အရေးကြီးမှု၊ အန္တရာယ်၊ အရေးပေါ် ဖြစ်မှုကို ဖော်ပြပါတယ်: သတိပေးချက်၊ မမေ့ရမယ့် deadline၊ စာတစ်ပိုဒ်ထဲမှာ အရေးကြီးဆုံး အပိုင်း။ <strong> ထဲမှာ <strong> ထပ်ထည့်ရင် အရေးကြီးမှု ပိုမြင့်တယ်လို့ ဆိုလိုပါတယ်။ <em> ကတော့ stress emphasis ပါ — စကားပြောရင် အသံ ဖိပြောမယ့် စကားလုံးပါ။ "I never said she stole the money" မှာ <em> ကို ဘယ်စကားလုံးပေါ် တင်လဲ ဆိုတာနဲ့ စာကြောင်းရဲ့ အဓိပ္ပာယ် ပြောင်းသွားပါတယ်။
<b> နဲ့ <i> က အဟောင်း tag တွေဖြစ်ပေမယ့် HTML5 က သူတို့ကို အဓိပ္ပာယ်အသစ် ပေးထားပါတယ်၊ "ပုံစံသက်သက်" မဟုတ်တော့ပါဘူး။ <b> က အရေးကြီးမှု မထပ်ပေးဘဲ အာရုံစိုက်စေချင်တဲ့ စာသားအတွက်ပါ — review ထဲက product name၊ summary ထဲက keyword တွေ။ Spec ကလည်း <b> ကို တခြား tag မသင့်တော်မှ နောက်ဆုံး ရွေးရမယ့် tag လို့ ဆိုထားပါတယ်။ <i> က အသံ ဒါမှမဟုတ် mood ပြောင်းတဲ့ စာသားအတွက်ပါ — technical term, Camellia sinensis လို သိပ္ပံအမည်၊ နိုင်ငံခြားစကားလုံး၊ ဇာတ်ကောင်ရဲ့ စိတ်ထဲက အတွေး။ နိုင်ငံခြားစကားလုံးဆိုရင် lang attribute ထည့်ပေးတာ ကောင်းပါတယ်၊ screen reader က အသံထွက် မှန်မှန် ဖတ်နိုင်ပါတယ်။
Browser ရဲ့ default style မှာ <strong> နဲ့ <b> က bold၊ <em> နဲ့ <i> က italic ပါ။ Screen reader အများစုက default setting မှာ <strong> နဲ့ <em> ကို အသံ ပြောင်းပြီး မဖတ်ပေမယ့် အဓိပ္ပာယ်က accessibility tree ထဲမှာ ရှိနေပြီး reader mode၊ ဘာသာပြန် tool နဲ့ ကိုယ့် CSS ကလည်း အသုံးပြုနိုင်ပါတယ်။ ဒါကြောင့် "screen reader က ဖတ်ပေးမယ်" ဆိုတာထက် "markup က အမှန်တရားကို ပြောနေလား" ဆိုတာကို အခြေခံပြီး ရွေးပါ။
အဓိပ္ပာယ် လုံးဝ မပါဘဲ ပုံစံအတွက်ပဲ ဆိုရင် — ဥပမာ card တိုင်းရဲ့ label ကို bold uppercase လုပ်ချင်တာ — tag လေးခုထဲက ဘာမှ မသုံးဘဲ <span class="label"> နဲ့ CSS font-weight ကို သုံးပါ။
- အရေးကြီး ဒါမှမဟုတ် သတိပေးချက်လား → <strong>
- အသံထွက်ရင် ဖိပြောမလား → <em>
- အသံ/term ပြောင်းလား → <i>
- ထင်ရှားရုံလား → <b>၊ အလှသက်သက် → CSS
အပေါ်ကနေ စမေးပြီး "ဟုတ်တယ်" ဆိုတဲ့ ပထမဆုံး အဖြေမှာ ရပ်ပါ။
အထွေထွေ ပုံစံ
<strong>important, serious or urgent text</strong>
<em>the word you would stress aloud</em>
<i lang="language-code">term, foreign phrase or thought</i>
<b>keyword or product name, no extra importance</b>
<span class="name">pure decoration, styled in CSS</span>Tag လေးခုလုံးက inline element တွေမို့ paragraph ထဲမှာ စာသားရဲ့ အလယ်မှာ ထည့်ရေးလို့ ရပါတယ်။ lang ကို နိုင်ငံခြားစကားလုံးအတွက်ပဲ လိုပြီး span ကတော့ အဓိပ္ပာယ် လုံးဝ မရှိတဲ့ ချိတ်ဆွဲစရာ (hook) သက်သက်ပါ။
Example: tag တစ်ခုစီကို အဓိပ္ပာယ်ရှိရှိ သုံးခြင်း
Paragraph လေးခုမှာ tag တစ်ခုစီကို တကယ် သင့်တော်တဲ့ နေရာမှာ သုံးထားပါတယ်။ ဖွင့်ကြည့်ရင် bold နှစ်ခု၊ italic နှစ်ခု မြင်ရပြီး markup ကို ဖတ်ရင်တော့ အကြောင်းပြချက် လေးမျိုး မြင်ရပါမယ်။
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Text-level semantics</title>
</head>
<body>
<p><strong>Warning:</strong> unplug the kettle before cleaning it.</p>
<p>I <em>never</em> said she stole the money.</p>
<p>The <b>Golden Leaf</b> blend is our best seller.</p>
<p>Tea comes from the plant <i lang="la">Camellia sinensis</i>.</p>
</body>
</html>Code ကို တစ်ပိုင်းချင်း ရှင်းပြမယ်
- Line 8
<p><strong>Warning:</strong> unplug the kettle before cleaning it.</p>ဘေးကင်းရေး သတိပေးချက်ဖြစ်လို့ အရေးကြီးမှုကို <strong> နဲ့ ဖော်ပြပါတယ်။ Warning ကို အနီရောင် ပြောင်းချင်ရင် strong ကို target လုပ်တဲ့ CSS က တကယ့် သတိပေးချက်ကိုပဲ ထိပါမယ်။
- Line 9
<p>I <em>never</em> said she stole the money.</p>"never" ကို ဖိပြောရင် "လုံးဝ မပြောခဲ့ဘူး" ဆိုတဲ့ အဓိပ္ပာယ်ပါ။ <em> ကို "she" ပေါ် ရွှေ့ရင် "တခြားသူ ခိုးတာ" လို့ အဓိပ္ပာယ် ပြောင်းသွားပါတယ်။
- Line 10
<p>The <b>Golden Leaf</b> blend is our best seller.</p>Product name ကို ထင်ရှားစေချင်ပေမယ့် အရေးကြီးမှု၊ သတိပေးချက် မဟုတ်လို့ <b> က သင့်တော်ပါတယ်။
- Line 11
<i lang="la">Camellia sinensis</i>Latin သိပ္ပံအမည်က တခြား "အသံ" တစ်ခုပါ။ lang="la" က ဒီစကားလုံးတွေ Latin ဖြစ်ကြောင်း browser နဲ့ screen reader ကို ပြောပါတယ်။
စာကြောင်း လေးကြောင်း ပေါ်ပါမယ်။ "Warning:" နဲ့ "Golden Leaf" က bold ဖြစ်ပြီး "never" နဲ့ "Camellia sinensis" က italic ဖြစ်ပါတယ်။<em> က အဓိပ္ပာယ် ပြောင်းပုံ နဲ့ CSS-only styling
| Markup | နားလည်ရမယ့် အဓိပ္ပာယ် |
|---|---|
| <em>I</em> never said she stole it. | တခြားတစ်ယောက်က ပြောခဲ့တာ |
| I never said <em>she</em> stole it. | တခြားတစ်ယောက်က ခိုးခဲ့တာ |
| I never said she <em>stole</em> it. | ခိုးတာ မဟုတ်ဘဲ ငှားသွားတာ ဖြစ်နိုင် |
Table ထဲက စာကြောင်း သုံးကြောင်းလုံးမှာ စကားလုံးတွေ အတူတူပါပဲ၊ <em> ရဲ့ နေရာ တစ်ခုပဲ ပြောင်းထားတာပါ။ ဒါကြောင့် <em> ကို ကျပန်း ထည့်တာ မဟုတ်ဘဲ စာရေးသူ ဆိုလိုချင်တဲ့ အဓိပ္ပာယ်ကို တိတိကျကျ ဖော်ပြဖို့ ရွေးချယ်တာပါ။ ဘာသာပြန်တဲ့သူနဲ့ ဘာသာပြန် tool တွေကလည်း ဒီ အချက်ကို ကြည့်ပြီး ဘာသာစကားသစ်မှာ ဘယ်စကားလုံးကို အလေးပေးရမလဲ ဆုံးဖြတ်နိုင်ပါတယ်။
အဓိပ္ပာယ် မပါတဲ့ အလှဆင်မှုအတွက်တော့ class တစ်ခုနဲ့ CSS ကို သုံးပါ။ အောက်က ဥပမာမှာ ဈေးနှုန်းကို bold အပြာရောင် ပြထားပေမယ့် <strong> မဟုတ်လို့ warning တွေအတွက် ရေးထားတဲ့ strong rule က ဈေးနှုန်းကို မထိတော့ပါဘူး။
<style>
strong { color: #b00020; }
.price { font-weight: 700; color: #1a4fa0; }
</style>
<p>Electric kettle, 1.7 litres. Price: <span class="price">$25</span></p>
<p><strong>Do not</strong> open the lid while the water is boiling.</p>လက်တွေ့ project တွေမှာ
Real project တွေမှာ ဘယ်လို သုံးလဲ
Rich text editor အများစုရဲ့ B ခလုတ်က နောက်ကွယ်မှာ <strong> ကို ထုတ်ပေးပြီး I ခလုတ်က <em> ကို ထုတ်ပေးကြပါတယ်။ Markdown မှာလည်း **text** က <strong> ဖြစ်ပြီး *text* က <em> ဖြစ်ပါတယ်။ ဒါကြောင့် CMS ကနေ လာတဲ့ content အများစုမှာ strong နဲ့ em ကို တွေ့ရပြီး site ရဲ့ CSS က အဲဒီ tag တွေကို ဘယ်လို style လုပ်မလဲ ဆိုတာ အရေးကြီးပါတယ်။
Documentation site တွေမှာ စာသားထဲက UI label တွေ ("Click Save") ကို <b> နဲ့၊ term အသစ်တွေကို ပထမဆုံး မိတ်ဆက်တဲ့အခါ <i> ဒါမှမဟုတ် <dfn> နဲ့ ရေးလေ့ ရှိပါတယ်။ Design system တွေမှာ badge, label, tag တွေကို bold ဖြစ်စေတာက class နဲ့ CSS ပါ၊ HTML tag မဟုတ်ပါဘူး၊ ဒါမှ component တစ်ခု ပြောင်းရင် အဓိပ္ပာယ်ကို မထိခိုက်ဘဲ ပုံစံကို ပြောင်းလို့ ရပါတယ်။ ဘာသာစကား နှစ်မျိုးသုံးတဲ့ site တွေမှာ <i lang="my"> လို markup က screen reader ကို Myanmar အသံထွက်နဲ့ ဖတ်စေနိုင်ပါတယ်။
အမှားများ
အဖြစ်များတဲ့ အမှားတွေ
1. Bold လိုချင်တိုင်း <strong> ထည့်တာ
ဈေးနှုန်း၊ နာမည်၊ label တွေကို <strong> ပေးလိုက်ရင် page ပေါ်က "အရေးကြီးတဲ့ စာ" အားလုံး အဓိပ္ပာယ်မဲ့သွားပြီး တကယ့် warning တွေ ထင်ရှားမှု မရှိတော့ပါဘူး။ Product name ဆိုရင် <b>၊ ပုံစံသက်သက် ဆိုရင် class နဲ့ CSS ကို သုံးပါ။
2. Italic လိုချင်လို့ <em> ကို စာကြောင်းတစ်ခုလုံး ပတ်တာ
<em> က ဖိပြောမယ့် စကားလုံးအတွက်ပါ၊ quote တစ်ခုလုံး ဒါမှမဟုတ် caption တစ်ခုလုံးကို italic ဖြစ်စေဖို့ မဟုတ်ပါဘူး။ စာကြောင်းတစ်ခုလုံး ဖိပြောနေရင် ဘာကိုမှ ဖိမပြောသလို ဖြစ်သွားပါတယ်။ ဒီလို နေရာမှာ CSS font-style: italic ကို သုံးပါ။
3. နိုင်ငံခြားစကားလုံးမှာ lang မထည့်တာ
lang မပါရင် English screen reader က ချေးငှားထားတဲ့ စကားလုံးကို English စကားလုံးလို အသံထွက် ဖတ်ပါတယ်။ <i lang="my">...</i> လို lang ထည့်ပေးတာက နားထောင်တဲ့သူအတွက် ပိုရှင်းပါတယ်။
Best Practices
အကောင်းဆုံး အလေ့အကျင့်များ
- Tag တစ်ခု မရွေးခင် "ဒီစာကို ဘာကြောင့် ထင်ရှားစေချင်တာလဲ" လို့ မေးပါ၊ အဖြေက tag ကို ရွေးပေးပါတယ်။
- Paragraph တစ်ခုမှာ <strong> တစ်ခု နှစ်ခုထက် မပိုစေပါနဲ့၊ အများကြီးဆိုရင် ဘာမှ ထင်ရှားမှု မရှိတော့ပါဘူး။
- Card label, badge, button စာသားလို ထပ်ခါထပ်ခါ ပေါ်တဲ့ bold style တွေကို class တစ်ခုနဲ့ CSS မှာ တစ်နေရာတည်း သတ်မှတ်ပါ။
- Page ရဲ့ ဘာသာစကားနဲ့ မတူတဲ့ စကားလုံးတိုင်းမှာ lang attribute ပေးပါ၊ italic မဖြစ်စေချင်ရင် span ပေါ်မှာလည်း ပေးလို့ ရပါတယ်။
Mini challenge
Mini challenge: product review တစ်ခု markup လုပ်ပါ
Rice cooker တစ်လုံးရဲ့ review လေးကို ရေးပါ။ Tag လေးခုလုံးကို သူ့ အဓိပ္ပာယ်အတိုင်း တစ်ကြိမ်စီ သုံးပြီး rating ကိုတော့ class နဲ့ CSS သုံးကာ ပုံစံပဲ ပေးပါ။
- Product name ကို <b>
- ဘေးကင်းရေး သတိပေးချက်ကို <strong>
- ဖိပြောမယ့် စကားလုံးတစ်လုံးကို <em>
- နိုင်ငံခြားစကားလုံးကို lang ပါတဲ့ <i>၊ rating ကို span.rating နဲ့ CSS
<!-- Put this inside a full page (doctype, head with charset and title, body) -->
<style>
/* TODO: style .rating (bold, a colour) with no HTML tag doing the work */
</style>
<!-- TODO: an <h1> heading for the review -->
<!-- TODO: a sentence naming the product with <b> -->
<!-- TODO: a sentence with one word stressed using <em> -->
<!-- TODO: a sentence with a foreign word in <i lang="..."> -->
<!-- TODO: a safety warning using <strong> -->
<!-- TODO: the rating inside <span class="rating"> -->ရလဒ်: Product name နဲ့ warning က bold၊ ဖိပြောတဲ့ စကားလုံးနဲ့ နိုင်ငံခြားစကားလုံးက italic ဖြစ်ပြီး rating က CSS ကနေ bold အရောင်နဲ့ ပေါ်ပါမယ်။
အရိပ်အမြွက် ကြည့်ရန်
Paragraph တစ်ခုစီကို အသံထွက် ဖတ်ကြည့်ပါ။ အသံ ဖိပြောမိတဲ့ စကားလုံးက <em>၊ "ဒါ မဖတ်ရင် အန္တရာယ်ရှိတယ်" ဆိုတဲ့ စာက <strong> ပါ။
အဖြေ ကြည့်ရန်
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Rice cooker review</title>
<style>
.rating { font-weight: 700; color: #b26a00; }
</style>
</head>
<body>
<h1>My rice cooker review</h1>
<p>I bought the <b>SteamKing 500</b> for my family last month.</p>
<p>It cooks rice <em>much</em> faster than my old pot.</p>
<p>It even keeps the <i lang="my">ထမင်း</i> warm until dinner.</p>
<p><strong>Never</strong> open the lid while it is still steaming.</p>
<p>My rating: <span class="rating">4 out of 5</span></p>
</body>
</html>Quick Quiz 1 / 3
Quick Quiz 2 / 3
Quick Quiz 3 / 3
မှတ်ထားရမယ့် အချက်များ
- <strong> = အရေးကြီး၊ အန္တရာယ်၊ အရေးပေါ်။ <em> = အသံ ဖိပြောတဲ့ စကားလုံး။
- <b> = အရေးမကြီးပေမယ့် ထင်ရှားစေချင်တဲ့ စာ။ <i> = term, နိုင်ငံခြားစကား၊ အတွေး။
- Tag ကို ပုံစံ မဟုတ်ဘဲ အဓိပ္ပာယ်နဲ့ ရွေးမှ CSS ကို နောက်မှ ဘေးကင်းစွာ ပြောင်းလို့ ရပါတယ်။
- အလှသက်သက်ဆိုရင် span နဲ့ class ပေးပြီး CSS ကို သုံးပါ။
HTML Living Standard — WHATWG