HTML <img> Tag
ဥပမာ
ပုံတစ်ပုံကို ထည့်သွင်းနည်း
<img src="img_girl.jpg" alt="Girl in a jacket" width="500" height="600">
အောက်တွင် နောက်ထပ် "စမ်းသုံးကြည့်ပါ" ဥပမာများ။
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
tag ကို <img>
HTML စာမျက်နှာတစ်ခုတွင် ပုံတစ်ပုံထည့်သွင်းရန် အသုံးပြုသည်။
ပုံများကို ဝဘ်စာမျက်နှာတစ်ခုတွင် နည်းပညာအရ ထည့်သွင်းမထားပါ။ ပုံများကို ဝဘ်စာမျက်နှာများနှင့် ချိတ်ဆက်ထားသည်။ တဂ် သည် <img>
ကိုးကားထားသောပုံအတွက် ထိန်းထားနိုင်သည့်နေရာကို ဖန်တီးပေးသည်။
တဂ် တွင် <img>
လိုအပ်သော အရည်အချင်းနှစ်ခု ရှိသည်-
- src - ပုံသို့ လမ်းကြောင်းကို သတ်မှတ်သည်။
- alt - အကြောင်းတစ်ခုခုကြောင့် ရုပ်ပုံကို မပြသနိုင်လျှင် ပုံအတွက် အလှည့်ကျ စာသားကို သတ်မှတ်ပါ။
မှတ်ချက်- ထို့အပြင်၊ ပုံတစ်ခု၏ အကျယ်နှင့် အမြင့်ကို အမြဲသတ်မှတ်ပါ။ အကျယ်နှင့် အမြင့်ကို မသတ်မှတ်ထားပါက၊ ပုံတင်နေစဉ် စာမျက်နှာသည် တုန်ခါသွားနိုင်သည်။
အကြံပြုချက်- ပုံတစ်ပုံကို အခြားစာရွက်စာတမ်းနှင့် လင့်ခ်ချိတ်ရန်၊ တဂ်ကို <a><img>
တဂ် တစ်ခုအတွင်း တွင် ရိုးရိုးရှင်းရှင်း (အောက်ပါ ဥပမာကို ကြည့်ပါ)။
Browser ပံ့ပိုးမှု
Element | |||||
---|---|---|---|---|---|
<img> | Yes | Yes | Yes | Yes | Yes |
ဂုဏ်တော်
Attribute | Value | Description |
---|---|---|
alt | text | Specifies an alternate text for an image |
crossorigin | anonymous use-credentials |
Allow images from third-party sites that allow cross-origin access to be used with canvas |
height | pixels | Specifies the height of an image |
ismap | ismap | Specifies an image as a server-side image map |
loading | eager lazy |
Specifies whether a browser should load an image immediately or to defer loading of images until some conditions are met |
longdesc | URL | Specifies a URL to a detailed description of an image |
referrerpolicy | no-referrer no-referrer-when-downgrade origin origin-when-cross-origin unsafe-url |
Specifies which referrer information to use when fetching an image |
sizes | sizes | Specifies image sizes for different page layouts |
src | URL | Specifies the path to the image |
srcset | URL-list | Specifies a list of image files to use in different situations |
usemap | #mapname | Specifies an image as a client-side image map |
width | pixels | Specifies the width of an image |
ကမ္ဘာလုံးဆိုင်ရာ အရည်အချင်းများ
<img>
tag သည် HTML တွင် Global Attributes ကို ပံ့ပိုး ပေးပါသည်။
ဖြစ်ရပ်ဂုဏ်တော်များ
<img>
tag သည် HTML ရှိ Event Attributes ကိုလည်း ပံ့ပိုး ပေးပါသည် ။
နောက်ထပ် ဥပမာများ
ဥပမာ
ပုံ (CSS ဖြင့် ချိန်ညှိပါ)
<img src="smiley.gif" alt="Smiley face" width="42" height="42" style="vertical-align:bottom">
<img src="smiley.gif" alt="Smiley face" width="42" height="42" style="vertical-align:middle">
<img src="smiley.gif" alt="Smiley face" width="42" height="42" style="vertical-align:top">
<img src="smiley.gif" alt="Smiley face" width="42" height="42" style="float:right">
<img src="smiley.gif" alt="Smiley face" width="42" height="42" style="float:left">
ဥပမာ
ပုံဘောင်ထည့်ရန် (CSS ဖြင့်)
<img src="smiley.gif" alt="Smiley face" width="42" height="42"
style="border:5px solid black">
ဥပမာ
ပုံသို့ ဘယ်ညာ အနားသတ်များ ထည့်ပါ (CSS ဖြင့်)
<img src="smiley.gif" alt="Smiley face" width="42" height="42"
style="vertical-align:middle;margin:0px 50px">
ဥပမာ
ပုံသို့ အပေါ်နှင့် အောက် အနားသတ်များ ထည့်ပါ (CSS ဖြင့်)
<img src="smiley.gif" alt="Smiley face" width="42" height="42" style="vertical-align:middle;margin:50px 0px">
ဥပမာ
အခြားဖိုင်တွဲမှ သို့မဟုတ် အခြားဝဘ်ဆိုက်မှ ပုံများကို ထည့်သွင်းနည်း-
<img src="/images/stickman.gif" alt="Stickman" width="24" height="39">
<img src="https://www.w3schools.com/images/lamp.jpg" alt="Lamp" width="32"
height="32">
ဥပမာ
ပုံတစ်ခုသို့ ဟိုက်ပါလင့်ခ်ကို ထည့်နည်း-
<a href="https://www.w3schools.com">
<img src="w3html.gif"
alt="W3Schools.com" width="100" height="132">
</a>
ဥပမာ
နှိပ်နိုင်သော ဒေသများဖြင့် ရုပ်ပုံမြေပုံ ဖန်တီးနည်း။ ဒေသတစ်ခုစီသည် ဟိုက်ပါလင့်ခ်တစ်ခုဖြစ်သည်-
<img src="workplace.jpg" alt="Workplace" usemap="#workmap" width="400"
height="379">
<map name="workmap">
<area shape="rect"
coords="34,44,270,350" alt="Computer" href="computer.htm">
<area
shape="rect" coords="290,172,333,250" alt="Phone" href="phone.htm">
<area shape="circle" coords="337,300,44" alt="Cup of coffee" href="coffee.htm">
</map>
ဆက်စပ်စာမျက်နှာများ
HTML သင်ခန်းစာ- HTML ပုံများ
HTML DOM ရည်ညွှန်း- ရုပ်ပုံအရာဝတ္ထု
CSS ကျူတိုရီရယ်- ပုံများကို ပုံစံရေးဆွဲခြင်း ။
မူရင်း CSS ဆက်တင်များ
ဘရောက်ဆာအများစုသည် <img>
အောက်ဖော်ပြပါ ပုံသေတန်ဖိုးများဖြင့် အစိတ်အပိုင်းကို ပြသလိမ့်မည်-
ဥပမာ
img {
display: inline-block;
}