HTML Tag Reference

HTML Living Standard

အသုံးများတဲ့ tag ရေးပုံကို ရှာပါ။ နမူနာတိုကို Run ပြီး မှားတတ်တဲ့အချက်ကို စစ်နိုင်ပါတယ်။

ဒီစာမျက်နှာမှာ

<a href="…">

Link စာသားကို <a> နဲ့ ပတ်ပြီး သွားမယ့်နေရာကို href မှာ ထည့်ပါ။ #hours လို path က စာမျက်နှာတစ်ခုတည်းထဲမှာ id တူတဲ့နေရာကို သွားပါတယ်။

စမ်းသပ်နည်း ဒီနမူနာကို .html ဖိုင်အသစ်အဖြစ် သိမ်းပြီး browser နဲ့ ဖွင့်ပါ။ ပြင်ပြီးတိုင်း save နဲ့ reload လုပ်ပါ။

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>&lt;a href="…"&gt;</title>
</head>
<body>
<a href="#hours">See opening hours</a>
<h2 id="hours">Opening hours</h2>
</body>
</html>

စမ်းကြည့်ရင် ဘာဖြစ်မလဲ See opening hours ကို နှိပ်ရင် သက်ဆိုင်တဲ့ ခေါင်းစဉ်ဆီ focus ရွှေ့ပါမယ်။

မှားတတ်တဲ့အချက် # နောက်က စာသားနဲ့ target ရဲ့ id တိတိကျကျ တူရပါမယ်။

<img src="…" alt="…">

ပုံဖိုင်ကို src မှာ ထည့်ပြီး ပုံက အချက်အလက် ပေးတယ်ဆိုရင် ပုံမမြင်ရတဲ့အခါ ဖတ်လို့ရမယ့် စာသားကို alt မှာ ရေးပါ။ img မှာ closing tag မရှိပါဘူး။

စမ်းသပ်နည်း ဒီနမူနာကို .html ဖိုင်အသစ်အဖြစ် သိမ်းပြီး browser နဲ့ ဖွင့်ပါ။ ပြင်ပြီးတိုင်း save နဲ့ reload လုပ်ပါ။

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>&lt;img src="…" alt="…"&gt;</title>
</head>
<body>
<img width="120" height="48" alt="Store logo"
  src="data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20viewBox=%270%200%20120%2048%27%3E%3Crect%20width=%27120%27%20height=%2748%27%20fill=%27teal%27/%3E%3Ctext%20x=%2742%27%20y=%2730%27%20fill=%27white%27%3EShop%3C/text%3E%3C/svg%3E">
</body>
</html>

စမ်းကြည့်ရင် ဘာဖြစ်မလဲ ထည့်ထားတဲ့ icon ပေါ်ပါမယ်။ src ကို ရှင်းပြီး alt စာသား ဘယ်လိုပေါ်လဲ ကြည့်ပါ။

မှားတတ်တဲ့အချက် အလှဆင်ဖို့ပဲ သုံးပြီး သက်ဆိုင်တဲ့အချက်အလက်ကို အနားမှာ ရေးထားပြီးသားဆို alt="" ထားပါ။

<label> နဲ့ <input>

label ရဲ့ for နဲ့ input ရဲ့ id ကို တူအောင်ရေးပါ။ Form ပို့တဲ့အခါ တန်ဖိုးကို ဘယ် field ကလာလဲ သိဖို့ name ပေးပါ။

စမ်းသပ်နည်း ဒီနမူနာကို .html ဖိုင်အသစ်အဖြစ် သိမ်းပြီး browser နဲ့ ဖွင့်ပါ။ ပြင်ပြီးတိုင်း save နဲ့ reload လုပ်ပါ။

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>&lt;label&gt; and &lt;input&gt;</title>
</head>
<body>
<label for="customer">Customer name</label>
<input id="customer" name="customer" type="text">
</body>
</html>

စမ်းကြည့်ရင် ဘာဖြစ်မလဲ Customer name ကို နှိပ်လိုက်ရင် input ဆီ focus ရောက်ပြီး နာမည်ရိုက်လို့ရပါမယ်။

မှားတတ်တဲ့အချက် for ကို id နဲ့ တွဲပါ။ name က FormData ထဲမှာ သုံးမယ့် key ပါ။

<button type="…">

Action တစ်ခု လုပ်ဖို့ button သုံးပါ။ Form ထဲက button က ပုံမှန်အားဖြင့် submit လုပ်ပါတယ်။ တခြား action အတွက် type="button" ပေးပါ။

စမ်းသပ်နည်း ဒီနမူနာကို .html ဖိုင်အသစ်အဖြစ် သိမ်းပြီး browser နဲ့ ဖွင့်ပါ။ ပြင်ပြီးတိုင်း save နဲ့ reload လုပ်ပါ။

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>&lt;button type="…"&gt;</title>
</head>
<body>
<form>
  <label for="order-note">Note</label>
  <input id="order-note" value="Less sugar">
  <button type="button" id="clear">Clear</button>
</form>
  <script>
document.querySelector("#clear").addEventListener("click", () => {
  document.querySelector("#order-note").value = "";
});
  </script>
</body>
</html>

စမ်းကြည့်ရင် ဘာဖြစ်မလဲ Clear နှိပ်ရင် form ထဲမှာပဲ ရှိနေပြီး input ထဲကစာ ပျောက်ပါမယ်။

မှားတတ်တဲ့အချက် မရည်ရွယ်ဘဲ form submit မဖြစ်ဖို့ button ရဲ့ type ကို အတိအကျ ရေးပါ။

နောက်ဆုံးလက်တွေ့ သုံးမျက်နှာပါ website

Home၊ Services နဲ့ Contact စာမျက်နှာတွေကို navigation တစ်ခုတည်းနဲ့ ချိတ်ပါ။ တစ်မျက်နှာစီမှာ သက်ဆိုင်ရာ title နဲ့ description ရေးပါ။ Services မှာ ဈေးနှုန်းဇယား၊ Contact မှာ label ပါတဲ့ form ထည့်ပါ။ Mouse မသုံးဘဲ Tab၊ Enter နဲ့ သုံးမျက်နှာလုံး သွားကြည့်ပါ။ Skip link က main ဆီ ရောက်သလား စစ်ပါ။ ဖိုင်တစ်ခုစီကို validator.w3.org မှာ စစ်ပြီး error တွေ ပြင်ပါ။

တရားဝင် ကိုးကားချက်များ