Other HTML5 Elements
<audio> နှင့် <video> Elements များ
Section titled “<audio> နှင့် <video> Elements များ”HTML5 ကြောင့် Flash လိုမျိုး တခြား ပြင်ပ Plugin တွေ မလိုတော့ဘဲ Audio, Video လို Media တွေကို Website တွေမှာ အလွယ်တကူ ထည့်သွင်းနိုင်လာပါတယ်။
<audio> Tag:
Section titled “<audio> Tag:”<audio> element ကို Webpage မှာ အသံဖိုင်တွေ (Audio) ထည့်ဖို့ သုံးပါတယ်။ MP3, Ogg, WAV လို Audio format မျိုးစုံကို Support ပေးပါတယ်။
ဥပမာ -
<audio controls> <source src="song.mp3" type="audio/mp3"> <source src="song.ogg" type="audio/ogg"> Your browser does not support the audio element.</audio>controls attribute ကတော့ Play, Pause လုပ်တာတွေ၊ အသံအတိုးအကျယ် (Volume) Control တွေကို အလိုအလျောက် ထည့်ပေးသွားမှာပါ။
<video> Tag:
Section titled “<video> Tag:”<audio> နဲ့ အလားတူပဲ <video> tag က Video content တွေ ထည့်သွင်းဖို့အတွက် ဖြစ်ပါတယ်။
ဥပမာ -
<video width="320" height="240" controls> <source src="movie.mp4" type="video/mp4"> <source src="movie.ogg" type="video/ogg"> Your browser does not support the video element.</video>controls က Play/Pause, Volume control နဲ့ တခြား လိုအပ်တဲ့ Control တွေကို ထည့်ပေးသွားမှာပါ။
<canvas> Element
Section titled “<canvas> Element”<canvas> tag က JavaScript ကိုသုံးပြီး Webpage ပေါ်မှာ Graphics တွေကို တိုက်ရိုက် ဆွဲခွင့်ပေးပါတယ်။ သူ့ကို Dynamic graphics တွေ၊ Animation တွေ၊ ဒါမှမဟုတ် Game element တွေ ဖန်တီးတဲ့နေရာမှာ အဓိက သုံးပါတယ်။
ဥပမာ -
<canvas id="myCanvas" width="500" height="500"></canvas>JavaScript ကိုသုံးပြီး Canvas ပေါ်မှာ ပုံစံတွေ၊ မျဉ်းတွေ၊ ပုံတွေ အစုံ ဆွဲနိုင်ပါတယ်။
JavaScript နဲ့ Canvas ပေါ်မှာ ဆွဲတဲ့ ဥပမာ -
let canvas = document.getElementById("myCanvas");let ctx = canvas.getContext("2d");
ctx.fillStyle = "blue";ctx.fillRect(50, 50, 150, 100); // Draws a blue rectangle<canvas> က ဘာကြောင့် အသုံးဝင်တာလဲ?
Section titled “<canvas> က ဘာကြောင့် အသုံးဝင်တာလဲ?”Game တွေ၊ Animation တွေနဲ့ Real-time visualization တွေလိုမျိုး Interactive ဖြစ်တဲ့ Graphics တွေ ဖန်တီးဖို့အတွက် အသင့်တော်ဆုံးပါပဲ။
SVG (Scalable Vector Graphics)
Section titled “SVG (Scalable Vector Graphics)”HTML5 မှာ SVG ကိုလည်း မိတ်ဆက်ပေးခဲ့ပါတယ်။ SVG ဆိုတာက XML format ကိုသုံးပြီး Vector graphics တွေ ဖန်တီးတဲ့ နည်းလမ်းတစ်ခုပါ။ JPEG, PNG တို့လို ရိုးရိုးပုံတွေနဲ့ မတူတာက SVG တွေက အရွယ်အစားကို ကြိုက်သလောက် ချဲ့ချုံ့လုပ်လည်း အရည်အသွေး (Quality) လုံးဝ မကျသွားပါဘူး။ ဒါကြောင့် Responsive web design အတွက် အသင့်တော်ဆုံး ဖြစ်ပါတယ်။
ဥပမာ -
<svg width="100" height="100"> <circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" /></svg>ဒီ Code က အနက်ရောင် ဘောင်ခတ်ထားတဲ့ အနီရောင် စက်ဝိုင်းတစ်ခုကို ဆွဲပေးပါတယ်။
ဘာကြောင့် SVG ကို သုံးသင့်လဲ?
Section titled “ဘာကြောင့် SVG ကို သုံးသင့်လဲ?”-
အရွယ်အစား ပြောင်းလွယ်ခြင်း - SVG တွေက အရွယ်အစား ချဲ့ချုံ့လုပ်လိုက်ပေမဲ့ အရည်အသွေး လုံးဝ မကျသွားပါဘူး။
-
အပြန်အလှန် တုံ့ပြန်နိုင်ခြင်း - SVG တွေကို CSS နဲ့ Style ပြင်လို့ရသလို၊ JavaScript နဲ့လည်း Interactive ဖြစ်အောင် ချိတ်ဆက် လုပ်ဆောင်နိုင်ပါတယ်။
<details> နှင့် <summary> Elements
Section titled “<details> နှင့် <summary> Elements”<details> element ကို သုံးပြီး JavaScript လုံးဝ မလိုဘဲ Show/Hide လုပ်နိုင်တဲ့ Collapsible content section လေးတွေ ဖန်တီးနိုင်ပါတယ်။ <summary> ကတော့ Click နှိပ်ရမယ့် ခေါင်းစဉ် Label ဖြစ်ပါတယ်။
ဥပမာ -
<details> <summary>HTML ဆိုတာ ဘာလဲ?</summary> <p>HTML (HyperText Markup Language) ဆိုတာ web ပေါ်မှာ content တွေကို structure ချဖို့သုံးတဲ့ language ဖြစ်ပါတယ်။</p></details>ဒီ Code လေးက FAQ section တွေ၊ Accordion menu တွေ ဖန်တီးဖို့အတွက် အသင့်တော်ဆုံးပါ — JavaScript တစ်ကြောင်းမှ မရေးဘဲ Browser ရဲ့ Built-in behavior ကိုသုံးပြီး Expand/Collapse လုပ်နိုင်ပါတယ်။
Local Storage နှင့် Data Attributes
Section titled “Local Storage နှင့် Data Attributes”1. Local Storage:
Section titled “1. Local Storage:”HTML5 က Page ကို ပိတ်လိုက်ပြီးရင်တောင်မှ User ရဲ့ Browser ထဲမှာ Data တွေကို သိမ်းထားနိုင်တဲ့ Local Storage ကို မိတ်ဆက်ပေးခဲ့ပါတယ်။ ဒီ Data တွေက User က Browser cache ကို မရှင်းမချင်း ဒါမှမဟုတ် ခင်ဗျားရဲ့ Code ကနေ လှမ်းမဖျက်မချင်း အမြဲ တည်ရှိနေမှာပါ။
ဥပမာ -
localStorage.setItem("username", "JohnDoe");var user = localStorage.getItem("username");Local storage ကို User preference တွေ (ဥပမာ - Dark mode/Light mode ရွေးထားတာ)၊ Form data တွေလိုမျိုး Data တွေကို Session တစ်ခုပြီးတစ်ခု မှတ်ထားဖို့ အဓိက သုံးပါတယ်။
2. Data Attributes:
Section titled “2. Data Attributes:”Data attribute တွေက Page ရဲ့ အမြင်ပိုင်း (UI) ကို မထိခိုက်စေဘဲ HTML tag တွေထဲမှာ လိုအပ်တဲ့ အပို Data တွေ ထည့်ခွင့်ပေးပါတယ်။ ဒီ Attribute တွေကို data- ဆိုတဲ့ စကားလုံးနဲ့ စရေးရပါတယ်။
ဥပမာ -
<div data-product-id="1234" data-price="29.99">Product 1</div>ဒီလို ထည့်ထားတဲ့ တန်ဖိုးတွေကို JavaScript နဲ့ ပြန်ယူသုံးပြီး ခင်ဗျားရဲ့ Webpage ကို ပိုပြီး Interactive ဖြစ်အောင် လုပ်ဆောင်နိုင်ပါတယ်။