Thuta Learning
HTML
ProjectsWeb Developmentအခြေခံ

Project 2: Landing Section

HTMLသင်ခန်းစာ 3445 မိနစ်

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • Document shell (lang၊ viewport၊ title) နဲ့ header/nav/main landmark တွေကို ရေးနိုင်ဖို့
  • Skip link ထည့်ပြီး in-page link တိုင်းရဲ့ target id ရှိမရှိ စစ်နိုင်ဖို့
  • Value proposition ကို h1 တစ်ခုတည်းနဲ့ ရေးပြီး section တိုင်းကို h2 ပေးနိုင်ဖို့
  • Navigation ဆိုရင် <a>၊ action ဆိုရင် <button> ဆိုပြီး CTA အတွက် ရွေးနိုင်ဖို့
  • Hero image ကို width/height၊ alt နဲ့ lazy မလုပ်ဘဲ ထည့်နိုင်ဖို့

ရိုးရိုးလေး ရှင်းပြမယ်

ရိုးရိုးလေး ရှင်းရရင်

Landing page ဆိုတာ ကြော်ငြာ ဒါမှမဟုတ် search result ကနေ လူတွေ ပထမဆုံး ရောက်လာတဲ့ page ပါ။ Hero section က အဲဒီ page ရဲ့ အပေါ်ဆုံး ပထမဆုံး မြင်ရတဲ့ အပိုင်းဖြစ်ပြီး စက္ကန့်အနည်းငယ်အတွင်း "ဒါဘာလဲ၊ ငါ့အတွက် ဘာအကျိုးရှိလဲ၊ နောက် ဘာလုပ်ရမလဲ" ဆိုတဲ့ မေးခွန်းသုံးခုကို ဖြေရပါတယ်။

ဆိုင်တစ်ဆိုင်ရဲ့ မျက်နှာစာ ဆိုင်းဘုတ်လို စဉ်းစားပါ။ ဆိုင်နာမည် (logo)၊ ဘာရောင်းလဲ (h1)၊ ရှင်းပြချက်တိုလေး (paragraph) နဲ့ "ဝင်ခဲ့ပါ" တံခါး (CTA link) ပါရပါမယ်။ ဒီ project မှာ ဒီအပိုင်းတွေကို semantic HTML နဲ့ ဆောက်ပြီး feature၊ pricing၊ contact section တွေနဲ့ ချိတ်ပါမယ်။

Problem → Why → Solution

ပြဿနာ: လှပေမယ့် ဘာမှ မပြောတဲ့ hero

Design file ကနေ မြန်မြန် ကူးထားတဲ့ hero တစ်ခုကို ကြည့်ပါ။ ခေါင်းစဉ်က စာလုံးကြီးပေမယ့် <div> ဖြစ်ပြီး "Start building" button က onclick ပါတဲ့ <div> ဖြစ်ပါတယ်။ Navigation link တွေက #pricing နဲ့ #contact ကို ညွှန်ပေမယ့် အဲဒီ id တွေ page ပေါ်မှာ မရှိပါဘူး။

Mouse သုံးသူအတွက် ကောင်းကောင်းကြည့်ရပေမယ့် keyboard user က CTA ဆီ Tab နဲ့ မရောက်ပါဘူး။ Screen reader user က h1 ကနေ ခုန်ကြည့်ရင် heading မတွေ့လို့ page က ဘာအကြောင်းလဲ မသိနိုင်ပါဘူး။ Search engine ကလည်း page ရဲ့ အဓိက topic ကို ခန့်မှန်းရပါတယ်။ "Pricing" ကို နှိပ်တဲ့ visitor တိုင်းကတော့ ဘာမှ မဖြစ်တာကို မြင်ရပြီး ထွက်သွားပါတယ်။

index.html
<nav>
  <a href="#features">Features</a>
  <a href="#pricing">Pricing</a>   <!-- no element has id="pricing" -->
</nav>
<div class="hero">
  <div class="big-title">Build AI-powered workflows faster</div>
  <div class="btn" onclick="location.href='/signup'">Start building</div>
</div>

ဘာကြောင့် ဒီလိုဖြစ်တာလဲ

<div> က ကြည့်ရတဲ့ပုံကိုပဲ ပေးပြီး meaning၊ focus နဲ့ keyboard behaviour ကို မပေးပါဘူး။ h1 က page ရဲ့ topic ကို browser၊ assistive technology နဲ့ search engine ကို ပြောတဲ့ element ပါ။ <a href> က focus ရပြီး Enter နဲ့ အလုပ်လုပ်ပါတယ်။ In-page link က target id မရှိရင် error မပြဘဲ ဘာမှ မလုပ်ပါဘူး။

Core concept: landing section ရဲ့ အလွှာ ငါးလွှာ

Landing page ကို အလွှာငါးလွှာ ထပ်ထားတာလို့ စဉ်းစားနိုင်ပါတယ်။ အလွှာတစ်ခုစီက မေးခွန်းတစ်ခုကို ဖြေပြီး တစ်ခုခု ကျန်ခဲ့ရင် design ဘယ်လောက်လှလှ page က အလုပ်မလုပ်ပါဘူး။

၁။ Document shell

<html lang="en"> က screen reader ကို အသံထွက်ပုံ ရွေးခွင့်ပေးပါတယ်။ viewport meta က phone မှာ desktop အရွယ်ကို ချုံ့မပြအောင် တားပါတယ်။ <title> က browser tab နဲ့ search result မှာ ပေါ်လို့ product နာမည်နဲ့ အကျိုးကျေးဇူးကို ရှင်းရှင်း ရေးပါ။

၂။ Landmark တွေနဲ့ skip link

<header>၊ <nav> နဲ့ <main> က assistive technology အတွက် ခုန်လို့ရတဲ့ မှတ်တိုင်တွေပါ။ Page ထဲက ပထမဆုံး link က "Skip to main content" ဖြစ်ပြီး <main id="main"> ကို ညွှန်ပါတယ်။ ဒါမှ keyboard user က page တိုင်းမှာ navigation link တွေကို Tab နဲ့ ပြန်ဖြတ်စရာ မလိုပါဘူး။

၃။ h1 တစ်ခုနဲ့ heading outline

Hero ရဲ့ h1 က value proposition ပါ။ "Welcome" မဟုတ်ဘဲ visitor ရမယ့် အကျိုးကို ရေးပါ။ Features၊ Pricing၊ Contact section တစ်ခုစီမှာ h2 ပေးလို့ outline က page ရဲ့ မာတိကာလို ဖြစ်လာပါတယ်။

၄။ CTA: link လား button လား

တခြား page ဒါမှမဟုတ် section ကို သွားရင် <a href> ပါ။ Form ပို့တာ၊ menu ဖွင့်တာလို page ပေါ်မှာ action လုပ်ရင် <button> ပါ။ Primary CTA ("Start building free") နဲ့ secondary CTA ("See the features") ကို text နဲ့ ခွဲပြပြီး "Click here" လို စကားလုံး မသုံးပါနဲ့။

၅။ Hero image

Hero ပုံက page ရဲ့ အကြီးဆုံး element ဖြစ်တတ်လို့ မြန်မြန် ပေါ်ရပါမယ်။ width/height ပေးပြီး loading="lazy" မထည့်ပါနဲ့။ Screenshot ဆိုရင် alt မှာ ဘာပြလဲ ဖော်ပြပြီး အလှသက်သက် နောက်ခံပုံဆိုရင် alt="" ထားပါ။

CTA က ဘာလုပ်လဲElement
Sign-up page ကို သွား<a href="/signup">
Page ထဲက section ကို ခုန်<a href="#features">
Email ကို subscribe form နဲ့ ပို့<button type="submit">
Mobile menu ကို ဖွင့်<button type="button">
Visitor ရဲ့ ပထမ စက္ကန့် ငါးစက္ကန့်
  1. Tab နဲ့ title: ဘယ်ရောက်နေလဲ
  2. h1: ဒါဘာလဲ၊ ဘာအကျိုးရှိလဲ
  3. Paragraph: ဘယ်လို ကူညီလဲ
  4. CTA: နောက် ဘာလုပ်ရမလဲ

CSS ပိတ်ပြီး ဒီ အစဉ်အတိုင်း ဖတ်လို့ရရင် structure မှန်ပါတယ်။ Mobile နဲ့ keyboard အစဉ်ကလည်း ဒီ source order ပဲ ဖြစ်ပါတယ်။

အခြေခံ ပုံစံ

html
<a href="#main">Skip to main content</a>
<header>logo link + <nav aria-label="...">links</nav></header>
<main id="main">
  <section class="hero">
    <h1>Benefit-focused headline</h1>
    <p>One or two sentences of support</p>
    <a href="/next-step">Primary action</a>
  </section>
  <section id="topic"><h2>Topic</h2> ... </section>
</main>

Skip link → header/nav → main → hero (h1 + p + CTA) → h2 section တွေ အစဉ်အတိုင်း စီပါ။ In-page link တိုင်းမှာ ကိုက်ညီတဲ့ id ရှိရပါမယ်။

Draftflow landing page

ဒါက landing page အပြည့်အစုံပါ: document shell၊ skip link၊ hero နဲ့ feature section၊ Pricing နဲ့ Contact section၊ CTA နှစ်ခုနဲ့ hero image တို့ပါ။ Nav link တိုင်းက page ပေါ်မှာ တကယ်ရှိတဲ့ section id ကို ညွှန်ထားလား စစ်ပါ၊ မရှိတဲ့ section ကို ညွှန်တဲ့ link က error မပြဘဲ ဘာမှ မလုပ်ပါဘူး။ dashboard-preview.png က placeholder ပါ။ "Draftflow" ကလည်း စမ်းသပ်ဖို့ ဖန်တီးထားတဲ့ product နာမည်ပါ။

index.html
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Draftflow: AI content workflows</title>
</head>
<body>
  <a href="#main">Skip to main content</a>
  <header>
    <a href="/">Draftflow</a>
    <nav aria-label="Main navigation">
      <ul>
        <li><a href="#features">Features</a></li>
        <li><a href="#pricing">Pricing</a></li>
        <li><a href="#contact">Contact</a></li>
      </ul>
    </nav>
  </header>

  <main id="main">
    <section class="hero">
      <h1>Build AI-powered workflows faster</h1>
      <p>Create, automate and manage your content workflow from one dashboard.</p>
      <p>
        <a href="/signup">Start building free</a>
        <a href="#features">See the features</a>
      </p>
      <img src="dashboard-preview.png" width="1200" height="675"
           alt="Draftflow dashboard with three automated workflows">
    </section>

    <section id="features">
      <h2>Key features</h2>
      <ul>
        <li>AI writing assistant</li>
        <li>Automation workflow builder</li>
        <li>Project dashboard</li>
      </ul>
    </section>

    <section id="pricing">
      <h2>Pricing</h2>
      <p>Free for three workflows. Pro costs $12 per month.</p>
    </section>

    <section id="contact">
      <h2>Contact</h2>
      <p><a href="mailto:hello@example.com">Email the Draftflow team</a></p>
    </section>
  </main>
</body>
</html>

Code ကို တစ်ပိုင်းချင်း ရှင်းပြမယ်

  1. Skip link first<a href="#main">Skip to main content</a>

    Page ထဲက ပထမဆုံး Tab stop ပါ။ Enter နှိပ်ရင် navigation ကို ကျော်ပြီး <main id="main"> ဆီ တန်းရောက်ပါတယ်။ CSS နဲ့ focus ရမှ ပေါ်အောင် လုပ်လေ့ရှိပါတယ်။

  2. Named navigation landmark<nav aria-label="Main navigation">

    aria-label က page မှာ nav တစ်ခုထက်ပိုရှိရင် (ဥပမာ footer nav) ခွဲခြားပေးပါတယ်။ Link တွေကို <ul> ထဲထည့်လို့ screen reader က "list, 3 items" လို့ ပြောပါတယ်။

  3. The value proposition<h1>Build AI-powered workflows faster</h1>

    Page တစ်ခုလုံးမှာ h1 တစ်ခုတည်းပါ။ Product နာမည်ထက် visitor ရမယ့် အကျိုးကို ပြောလို့ search result နဲ့ screen reader နှစ်ခုလုံးအတွက် topic ကို ရှင်းစေပါတယ်။

  4. Primary CTA is a link<a href="/signup">Start building free</a>

    Sign-up page ကို သွားတာမို့ navigation ပါ။ ဒါကြောင့် <button> မဟုတ်ဘဲ <a href> ဖြစ်ပါတယ်။ Text က action နဲ့ "free" ဆိုတဲ့ အချက်ကို ပြောလို့ ဘာဖြစ်မလဲ ကြိုသိနိုင်ပါတယ်။

  5. Hero image without lazy loading<img src="dashboard-preview.png" width="1200" height="675"

    width/height က 16:9 အချိုးကို ကြိုသတ်မှတ်လို့ layout မခုန်ပါဘူး။ ပထမဆုံး မြင်ရတဲ့ ပုံမို့ loading="lazy" မထည့်ထားပါဘူး။

  6. A real target for the nav link<section id="pricing">

    Nav ထဲက href="#pricing" က ဒီ id ကို ရှာပါတယ်။ id နဲ့ href ရဲ့ စာလုံး အကြီးအသေးပါ တူရပါမယ်။

You should see
CSS မပါလို့ အပေါ်ကနေ အောက်ကို ပေါ်ပါမယ်။ "Skip to main content" link၊ "Draftflow" link၊ Features/Pricing/Contact bullet list၊ အကြီးစား "Build AI-powered workflows faster" h1၊ ရှင်းပြချက်၊ "Start building free" နဲ့ "See the features" link နှစ်ခု၊ ပုံနေရာ (ပုံမရှိသေးရင် alt text)၊ ပြီးတော့ Key features၊ Pricing၊ Contact h2 section တွေ ပေါ်ပါမယ်။ Browser tab မှာ "Draftflow: AI content workflows" ပေါ်ပြီး nav link တိုင်းက သက်ဆိုင်ရာ section ကို ခုန်ပါတယ်။

Hero image ကို ပိုမြန်အောင်

Landing page တွေရဲ့ speed ကို တိုင်းတဲ့အခါ Largest Contentful Paint (LCP) ဆိုတဲ့ "အကြီးဆုံး element ပေါ်လာချိန်" ကို အများဆုံး ကြည့်ပါတယ်။ Hero ပုံက အဲဒီ element ဖြစ်တတ်လို့ Responsive Images lesson က srcset/sizes ကို သုံးပြီး phone တွေကို ပုံသေး ပေးပါ။ fetchpriority="high" က ဒီပုံကို အရင် download လုပ်ဖို့ browser ကို hint ပေးတာပါ။ Hint သာဖြစ်လို့ browser က လိုက်နာမယ်လို့ အာမခံချက် မရှိပါဘူး။

html
<img src="dashboard-1200.png"
     srcset="dashboard-600.png 600w, dashboard-1200.png 1200w"
     sizes="(max-width: 700px) 100vw, 1200px"
     width="1200" height="675" fetchpriority="high"
     alt="Draftflow dashboard with three automated workflows">

လက်တွေ့ project တွေမှာ

လက်တွေ့ project တွေမှာ

Startup တွေ၊ online course တွေ၊ app launch တွေက ကြော်ငြာ campaign တစ်ခုချင်းစီအတွက် landing page သီးသန့် ဆောက်လေ့ရှိပါတယ်။ Marketing team က h1 စာနဲ့ CTA text ကို A/B test လုပ်ပြီး ဘယ်ဟာ sign-up ပိုရလဲ တိုင်းပါတယ်။ ဒါကြောင့် HTML structure က ခိုင်မာနေရပြီး စာသားကိုပဲ လွယ်လွယ် လဲလို့ရရပါမယ်။

Launch မလုပ်ခင် team တွေက checklist နဲ့ စစ်ပါတယ်။ Tab key တစ်ခုတည်းနဲ့ skip link ကနေ CTA အထိ ရောက်လား၊ nav link တိုင်း target ရှိလား၊ phone အရွယ် 320px မှာ h1 ဖတ်လို့ရလား၊ ပုံမ load ရရင် alt text နဲ့ အဓိပ္ပာယ် ပေါ်လား၊ Lighthouse မှာ LCP ကောင်းလား စတာတွေပါ။ Search result မှာ ပေါ်တဲ့ <title> နဲ့ meta description ကိုလည်း SEO lesson မှာ လေ့လာခဲ့တဲ့အတိုင်း page တစ်ခုချင်းအတွက် သီးသန့် ရေးပါတယ်။

အမှားများ

ဖြစ်လေ့ရှိတဲ့ အမှားများ

Target မရှိတဲ့ in-page link

href="#pricing" ရေးပြီး section ကို id="Pricing" (P အကြီး) လို့ ပေးရင် နှိပ်လို့ ဘာမှ မဖြစ်ပါဘူး။ Browser က error မပြလို့ nav link တိုင်းကို ကိုယ်တိုင် နှိပ်စမ်းပါ။

Navigation အတွက် <button> သုံးတာ

<button onclick="location.href='/signup'"> က middle-click နဲ့ tab အသစ်မှာ မဖွင့်နိုင်၊ link ကို copy မလုပ်နိုင်ပါဘူး။ Screen reader ကလည်း button လို့ ကြေညာလို့ page ပြောင်းမယ်မှန်း မသိရပါဘူး။ Page ပြောင်းရင် <a href> ပါ။

Hero ပုံကို lazy load လုပ်တာ

Page တိုင်းမှာ loading="lazy" ကို copy-paste လုပ်တတ်ပေမယ့် ပထမဆုံး မြင်ရတဲ့ ပုံမှာ ထည့်ရင် browser က layout ပြီးမှ download စလို့ LCP နှေးသွားပါတယ်။ Lazy ကို screen အောက်ပိုင်းက ပုံတွေမှာပဲ သုံးပါ။

h1 ကို logo အတွက် သုံးတာ

Page တိုင်းမှာ logo ကို h1 လုပ်ထားရင် site တစ်ခုလုံးရဲ့ h1 က "Draftflow" ဖြစ်နေပြီး page တစ်ခုချင်းရဲ့ topic ကို မပြောတော့ပါဘူး။ Logo ကို link ထားပြီး h1 ကို page ရဲ့ အဓိက message အတွက် သုံးပါ။

Mini challenge

ဘာသာစကား သင်တန်းအတွက် landing section

"Speak English in 12 weeks" သင်တန်းအတွက် landing page တစ်ခု ဆောက်ပါ။ Hero မှာ h1၊ ရှင်းပြချက်၊ primary CTA (enrolment page ကို link) နဲ့ secondary CTA (schedule section ကို in-page link) ပါရမယ်။ Email subscribe form လည်း ပါရမယ်။

  • lang၊ viewport meta နဲ့ သင်တန်းအကြောင်း ပြောတဲ့ <title> ပါရမယ်
  • Skip link နဲ့ aria-label ပါတဲ့ nav ပါရမယ်၊ in-page link တိုင်းမှာ ကိုက်ညီတဲ့ id ရှိရမယ်
  • h1 တစ်ခုတည်း ရှိပြီး Schedule နဲ့ Stay updated section တွေမှာ h2 ပါရမယ်
  • CTA နှစ်ခုက <a>၊ subscribe form ရဲ့ submit က <button> ဖြစ်ရမယ်၊ email input မှာ label ပါရမယ်
course.html
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <!-- TODO: viewport meta and a descriptive <title> -->
</head>
<body>
  <!-- TODO: skip link to #main -->
  <header>
    <!-- TODO: logo link + nav (aria-label) linking to #schedule and #updates -->
  </header>
  <main id="main">
    <!-- TODO: hero: h1, one supporting sentence, -->
    <!--   primary CTA -> /enrol, secondary CTA -> #schedule -->

    <!-- TODO: section#schedule with an h2 and a list of class times -->

    <!-- TODO: section#updates with an h2 and a subscribe form: -->
    <!--   labelled email input + submit button -->
  </main>
</body>
</html>

ရလဒ်: Browser tab မှာ သင်တန်းနာမည် ပေါ်ပြီး page ပေါ်မှာ skip link၊ logo၊ nav၊ h1၊ ရှင်းပြချက်၊ CTA link နှစ်ခု၊ Schedule section (class time list) နဲ့ "Email address" label ပါတဲ့ subscribe form ပေါ်ပါမယ်။ "See the schedule" နဲ့ nav link တွေက သက်ဆိုင်ရာ section ကို ခုန်ပြီး Tab key က skip link ကနေ Subscribe button အထိ အစဉ်လိုက် ရောက်ပါမယ်။

အရိပ်အမြွက် ကြည့်ရန်

Href တစ်ခုစီကို ရေးပြီးတာနဲ့ သက်ဆိုင်တဲ့ id ကို ချက်ချင်း ရေးလိုက်ပါ။ Form ရဲ့ <label for> နဲ့ <input id> ကလည်း တူရပါမယ်။ ပြီးရင် Tab key တစ်ခုတည်းနဲ့ page တစ်ခုလုံးကို ဖြတ်ကြည့်ပါ။

အဖြေ ကြည့်ရန်
course.html
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Speak English in 12 weeks | Evening course in Yangon</title>
</head>
<body>
  <a href="#main">Skip to main content</a>
  <header>
    <a href="/">Bright English School</a>
    <nav aria-label="Main navigation">
      <ul>
        <li><a href="#schedule">Schedule</a></li>
        <li><a href="#updates">Updates</a></li>
      </ul>
    </nav>
  </header>

  <main id="main">
    <section class="hero">
      <h1>Speak English with confidence in 12 weeks</h1>
      <p>Small evening classes, real conversations and a teacher who knows your name.</p>
      <p>
        <a href="/enrol">Enrol for the June class</a>
        <a href="#schedule">See the schedule</a>
      </p>
    </section>

    <section id="schedule">
      <h2>Schedule</h2>
      <ul>
        <li>Monday and Wednesday, 6:30 to 8:00 pm</li>
        <li>Saturday, 9:00 to 11:00 am</li>
      </ul>
    </section>

    <section id="updates">
      <h2>Stay updated</h2>
      <form action="/subscribe" method="post">
        <label for="email">Email address</label>
        <input id="email" name="email" type="email" required>
        <button type="submit">Subscribe</button>
      </form>
    </section>
  </main>
</body>
</html>

Quick Quiz 1 / 3

Hero ရဲ့ "Start free trial" CTA က /signup page ကို သွားတယ်။ ဘယ် markup က အမှန်ဆုံးလဲ။

Quick Quiz 2 / 3

<a href="#main">Skip to main content</a> အလုပ်လုပ်ဖို့ ဘာလိုလဲ။

Quick Quiz 3 / 3

Hero ပုံမှာ loading="lazy" ထည့်ရင် ဘာဖြစ်မလဲ။

မှတ်ထားရမယ့် အချက်များ

  • Landing page ကို shell → landmark/skip link → h1 → CTA → hero image အလွှာတွေနဲ့ စစ်ပါ
  • h1 တစ်ခုတည်းက value proposition ကို ပြောပြီး section တိုင်းမှာ h2 ပါရမယ်
  • Page ပြောင်းရင် <a href>၊ action လုပ်ရင် <button> ပါ
  • In-page link တိုင်းမှာ စာလုံးအတိအကျ ကိုက်တဲ့ id ရှိရမယ်
  • Hero ပုံမှာ width/height နဲ့ alt ထည့်ပြီး lazy မလုပ်ပါနဲ့

HTML Living Standard — WHATWG

နောက်ဆုံးပြင်ဆင်ရက်

Progress ကို ဤ browser (ဤစက်) တွင်သာ သိမ်းထားပါသည်။ အခြားစက်များနှင့် sync မလုပ်ပါ။

ဤသင်ခန်းစာတွင် အမှားတွေ့ပါက အကြောင်းကြားရန်သင့် email app ကို ဤသင်ခန်းစာလိပ်စာ ဖြည့်ပြီးသားဖြင့် ဖွင့်ပေးပါမည် — သင်ကိုယ်တိုင် ပို့မှသာ ပို့မည်ဖြစ်သည်။

Project 2: Landing Section | Thuta Learning