Form နဲ့ Table ကို Style ပေးခြင်း

W3C CSS Snapshot 2026

Field တွေ သုံးရလွယ်ဖို့ အကွာအဝေးနဲ့ focus style ပေးပါ။ Table တွေမှာ တန်ဖိုးတွေ နှိုင်းရလွယ်အောင် ညှိပါ။

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

Field တွေ Style ပေးပြီး Focus မြင်သာအောင်ထားခြင်း

Form control တွေကို ပတ်ဝန်းကျင်စာသားနဲ့ font တူဖို့ font: inherit ပေးပါ။ နှိပ်လို့ကောင်းအောင် padding ပေးပါ။ :focus-visible က keyboard နဲ့ ရွှေ့တဲ့အခါ လက်ရှိ focus ရောက်နေတဲ့ control ကို မြင်သာစေပါတယ်။

စမ်းသပ်နည်း ဒီနမူနာကို .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>Style fields and keep focus visible</title>
  <style>
form { display: grid; gap: 8px; max-width: 300px; }
input, button { font: inherit; padding: 8px; border: 1px solid #497676; border-radius: 6px; }
button { background: #006767; color: white; }
:focus-visible { outline: 3px solid #a13a00; outline-offset: 2px; }
  </style>
</head>
<body>
<form><label for="name">Order name</label><input id="name" name="name"><button type="button">Continue</button></form>
</body>
</html>

စမ်းကြည့်ရင် ဘာဖြစ်မလဲ Preview ထဲအရင် နှိပ်ပါ။ Tab နဲ့ field နဲ့ button ကြား ရွှေ့ပြီး focus အနားသတ်ကို ကြည့်ပါ။

ဈေးနှုန်း ညှိပြီး Row တွေ အရောင်ခွဲခြင်း

border-collapse: collapse က ကပ်လျက် border တွေ ပေါင်းပေးပါတယ်။ tbody tr:nth-child(even) က table body ထဲက စုံဂဏန်း row တွေ ရွေးပါတယ်။ ဈေးနှုန်းဂဏန်းတွေ တန်းအောင် ညာဘက်ညှိပါ။

စမ်းသပ်နည်း ဒီနမူနာကို .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>Align prices and stripe table rows</title>
  <style>
table { width: 100%; max-width: 360px; border-collapse: collapse; }
th, td { padding: 8px; text-align: left; border-bottom: 1px solid #888; }
tr > :last-child { text-align: right; }
tbody tr:nth-child(even) { background: #def5f5; }
  </style>
</head>
<body>
<table><caption>Product price list</caption>
<thead><tr><th scope="col">Product</th><th scope="col">Price (MMK)</th></tr></thead>
<tbody><tr><td>Pen</td><td>1,500</td></tr><tr><td>Desk Lamp</td><td>2,500</td></tr></tbody></table>
</body>
</html>

စမ်းကြည့်ရင် ဘာဖြစ်မလဲ ဒုတိယ row မှာ နောက်ခံရောင်ရှိပြီး ဈေးနှုန်းတွေ ညာဘက် တစ်တန်းတည်း ဖြစ်ပါမယ်။

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