Myanmar Coder Guide

Course Outline from w3school.com

Friday, December 11, 2020

HTML Images

ပုံများသည်ဝဘ်စာမျက်နှာ၏ဒီဇိုင်းနှင့်အသွင်အပြင်ကိုတိုးတက်စေနိုင်သည်။


Heart Red Leafed Tree on Red Field road near mountain Tree Photo

Example


  1. <img  src="images.jpg""  alt="images.jpg">

Try if yourself »

Example


  1. <img  src="road-near-mountain.jpg"  alt="road near mountain.jpg">

Try if yourself »

Example


  1. <img  src="coffee-and-dell.jpg"  alt="coffee and dell.jpg">

Try if yourself »

HTML Images Syntax

HTML <img> tag ကိုဝဘ်စာမျက်နှာတစ်ခုမှာပုံတစ်ပုံထည့်ရန်အသုံးပြုသည်။ ပုံများကိုနည်းပညာအားဝဘ်စာမျက်နှာတစ်ခုထဲသို့ထည့်သွင်းခြင်းမပြုပါ။ ပုံများကို web စာမျက်နှာများနှင့်ဆက်စပ်လျက်ရှိသည်။ <img> tag သည်ရည်ညွှန်းထားသောရုပ်ပုံအတွက်သိုလှောင်နေရာတစ်ခုဖန်တီးပေးသည်။ <img> tag သည်ဗလာဖြစ်ပြီး၎င်းတွင် attribute များသာပါဝင်ပြီး၊ ပိတ်ထားသော tag မရှိပါ။ <img> tag တွင်လိုအပ်သော attribute နှစ်ခုရှိသည်။
src - ပုံ၏လမ်းကြောင်းကိုသတ်မှတ်သည်။
alt - ပုံအတွက်အခြားစာသားတစ်ခုသတ်မှတ်သည်။

Syntax


  1. <img  src="url"  rel="alternatetext">

The alt Attribute

လိုအပ်သော src attribute သည် အသုံးပြုသူသည်အကြောင်းပြချက်တချို့ကြောင့်ကြည့်ရှု့ မရနိုင်ပါကရုပ်ပုံအတွက်အခြားစာသားတစ်ခုပေးသည်။ (နှေးကွေးသောကြောင့်၊ src attribute တွင်အမှားတစ်ခုခုပါရှိပါက သိုမဟုတ် အကြောင်းတခုခုကြာင့်ပုံမပေါ်လျှင်) ။
alt attribute ၏တန်ဖိုကိုဖော်ပြပေသည်။

Example


  1. <img  src="road_near_mountain.jpg"  alt="road near mountain.jpg">

Try if yourself »

browser တစ်ခုမှပုံတစ်ပုံကိုရှာမတွေ့ပါက၎င်းသည် alt attribute ၏တန်ဖိုးကိုပြလိမ့်မည်။

Example


  1. <img  src="road_near_mountain.jpg"  alt="road near mountain.jpg">

Try if yourself »

Image Size - Width and Height

ပုံ၏အကျယ်နှင့်အမြင့်ကိုသတ်မှတ်ရန် style attribute ကိုသုံးနိုင်သည်။

Example


  1. <img  src="road_near_mountain.jpg"  alt="road near mountain.jpg"  style="width:500px ;height:600px ;">

Try if yourself »

နောက်တစ်နည်းအနေနဲ့width and heightတွေကိုသုံးနိုင်ပါတယ်။

Example


  1. <img  src="road_near_mountain.jpg"  alt="road near mountain.jpg"  width="500px"  height="600px">

Try if yourself »

The width and height width နဲ့ height attribute တွေကပုံရဲ့ width နဲ့ height ကို pixel ထဲမှာအမြဲသတ်မှတ်ပါတယ်။

မှတ်ချက် - ပုံရဲ့အကျယ်နဲ့အမြင့်ကိုအမြဲတမ်းသတ်မှတ်ပါ။ အကယ်၍ အကျယ်နှင့်အမြင့်ကိုမသတ်မှတ်ပါကပုံတင်နေစဉ်ဝက်ဘ်စာမျက်နှာသည်တုန်ခါသွားနိုင်သည်။

Width and Height,or Style?

width, height နဲ့ style attribute တွေအားလုံးက HTML မှာတရားဝင်ပါတယ်။ သို့သော် style attribute ကိုအသုံးပြုရန်ကျွန်ုပ်တို့အကြံပြုပါသည်။ ပုံ၏အရွယ်အစားကိုမပြောင်းလဲစေရန် style sheets များကကာကွယ်ပေးသည်။

Example

  1. <!DOCETYPE   html>
  2. <html>
  3. <head>
  4. <style>
  5. img  {
  6.    width :100% ;
  7. }
  8. </style>
  9. </head>
  10. <body>
  11. <img  src="html5.gif"   alt="HTML5 Icon  width="128"  height="128">
  12. <img  src="html5.gif"   alt="HTML5 Icon  style ="width:128px;heigth:128px;">
  13. </body>
  14. </html>
Try if yourself »

Images in Another Folder

သင့်တွင်ရုပ်ပုံများကိုဖိုင်တွဲငယ်တစ်ခုတွင်ထားရှိပါက src attribute တွင်ဖိုလ်ဒါအမည်ထည့်ရမည်။

Example

  1. <img  src="/images/heml5.gif"  alt="HTML5 Icon"  
  2.   style ="width:128px;heigth:128px;">
Try if yourself »

Animated Images

HTML သည် animated GIF များကိုခွင့်ပြုသည်။

Example

  1. <img  src="programming.gif"  alt="Computer Man"  
  2.   style ="width:40px;heigth:40px;">
Try if yourself »

Image as a Link

ပုံကိုလင့်ခ်တစ်ခုအနေဖြင့်အသုံးပြုလိုပါက <img> tag ကို <a> tag အတွင်း၌ထည့်ပါ။

Example

  1. <a  href="default.asp">
  2. <img  src="smiley.gif"  alt="HTML tutorial"  style="width:42px;height:42px;">
  3. </a>
Try if yourself »

Image Floating

စာသားရဲ့ညာဖက်ဒါမှမဟုတ်ဘယ်ဘက်အပေါ် float ခွင့်ပြုရန် CSS float property ကိုသုံးပါ။

Example

  1. <p><img  src="smiley.gif"  alt="Smiley face"  style="float:right;width:42px;height:42px;">
  2. The image will float to the right of the text.<p>

  3. <p><img  src="smiley.gif"  alt="Smiley face"  style="float:right;width:42px;height:42px;">
  4. The image will float to the right of the text.<p>
Try if yourself »

Common Image Formats

(Chrome, Edge, Firefox, Safari, Opera) မှာတွေ့ရတတ်တဲ့ image file အမျိုးအစားများဖြစ်သည်။

Abbreviation File Format File Extension
APNG Animated Portable Network Graphics .apng
GIF Graphics Interchange Format .gif
ICO Microsoft Icon .ico, .cur
JPEG Joint Photographic Expert Group image .jpg, .jpeg, .jfif, .pjpeg, .pjp
PNG Portable Network Graphics .png
SVG Scalable Vector Graphics .svg

Chapter Summary

  • ပုံတစ်ပုံကိုသတ်မှတ်ရန် HTML <img> element ကိုသုံးပါ။
  • ပုံ၏ URL ကိုသတ်မှတ်ရန် HTML src attribute ကိုသုံးပါ။
  • ပုံတစ်ပုံအတွက်ပြသရန်မဖြစ်နိုင်ပါကအခြားစာသားကိုသတ်မှတ်ရန် HTML alt attribute ကိုအသုံးပြုပါ။
  • ပုံ၏အရွယ်အစားကိုသတ်မှတ်ရန် HTML width နှင့် heigth attribute များသို့မဟုတ် CSS width နှင့် heigth property များကိုသုံးပါ။
  • ဘယ်ဘက်သို့ညာဘက်သို့ float ခွင့်ပြုရန် CSS float property ကိုသုံးပါ။

မှတ်ချက်-ပုံကြီးများကိုတင်ခြင်းသည်အချိန်ယူရပြီးသင်၏ဝက်ဘ်စာမျက်နှာကိုနှေးကွေးစေနိုင်သည်။ ပုံတွေကိုဂရုတစိုက်သုံးပါ။

No comments:

Post a Comment