Image width attribute
Definition and Usage
width
attribute sets or returns the image's width attribute value.
HTML width attribute specifies the width of the image.
This attribute can also return the width of the image using CSS styles (see the example below).
Tip:Use height attribute set or return the image's height attribute value.
Example
Example 1
Change the width of the image to 450px:
document.getElementById("myImg").width = "450";
Example 2
return the width of the image:
var x = document.getElementById("myImg").width;
Example 3
Change the height and width of the image to 300px and 450px respectively:
document.getElementById("myImg").height = "300"; document.getElementById("myImg").width = "450";
Example 4
return the width of the image using CSS styles:
var x = document.getElementById("myImg").width;
Syntax
return width attribute:
imageObject.width
set width attribute:
imageObject.width = pixels
প্রতিযোগিতা মূল্য
মূল্য | বর্ণনা |
---|---|
pixels | পিক্সেলের পরিমাণের প্রস্থতা (উদাহরণ: width="100") |
প্রযুক্তিগত বিবরণ
ফলাফল: | সংখ্যা, চিত্রের প্রস্থতা পিক্সেলে প্রকাশ করা হয়。 |
---|
ব্রাউজার সমর্থন
চ্রোম | এডজ | ফায়ারফক্স | স্যাফারি | ওপেরা |
---|---|---|---|---|
চ্রোম | এডজ | ফায়ারফক্স | স্যাফারি | ওপেরা |
সমর্থন | সমর্থন | সমর্থন | সমর্থন | সমর্থন |
সংশ্লিষ্ট পাতা
HTML পরিচ্ছেদক:HTML <img> width প্রতিযোগিতা