HTML DOM Element clientHeight
❮ Element Objectဥပမာ
padding အပါအဝင် "myDIV" ၏ အမြင့်နှင့် အကျယ်ကို ရယူပါ-
const elmnt = document.getElementById("myDIV");
let text = "Height with padding: " + elmnt.clientHeight + "px<br>";
text += "Width with padding: " + elmnt.clientWidth + "px";
အောက်တွင် နောက်ထပ် ဥပမာများ။
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
ပိုင်ဆိုင်မှု သည် clientHeight
အကွက်များအပါအဝင် pixels တွင်မြင်နိုင်သော ဒြပ်စင်တစ်ခု၏အမြင့်ကို ပြန်ပေးသည်၊ သို့သော် ဘောင်၊ scrollbar သို့မဟုတ် margin မဟုတ်ပါ။
clientHeight
ပိုင်ဆိုင်မှုသည် ဖတ်ရန်သာဖြစ်သည် ။
ကျူတိုရီရယ်
ကိုလည်းကြည့်ပါ-
Element သည် Height Property ကို လွန်ကဲသည်။
Element သည် Width Property ကို offset
ဒြပ်စင်တစ်ခုသို့ scrollbars များထည့်ရန် CSS overflow property ကိုသုံးပါ။
အထားအသို
element.clientHeight
တန်ဖိုးကို ပြန်ပေးသည်။
ရိုက်ပါ။ | ဖော်ပြချက် |
နံပါတ် | padding အပါအဝင် ဒြပ်စင်၏ မြင်နိုင်သော အမြင့် (pixels) |
clientHeight/clientWidth နှင့် offsetHeight/offsetWidth အကြား ကွာခြားချက်
scrollbar မပါဘဲ
const elmnt = document.getElementById("myDIV");
let text = "";
text += "Height with padding: " + elmnt.clientHeight + "px<br>";
text += "Height with padding and border: " + elmnt.offsetHeight + "px<br>";
text += "Width with padding: " + elmnt.clientWidth + "px<br>";
text += "Width with padding and border: " + elmnt.offsetWidth + "px";
scrollbar ဖြင့်-
const elmnt = document.getElementById("myDIV");
let text = "";
text += "Height with padding: " + elmnt.clientHeight + "px<br>";
text += "Height with padding, border and scrollbar: " + elmnt.offsetHeight + "px<br>";
text += "Width with padding: " + elmnt.clientWidth + "px<br>";
text += "Width with padding, border and scrollbar: " + elmnt.offsetWidth + "px";
Browser ပံ့ပိုးမှု
element.clientHeight
ဘရောက်ဆာအားလုံးတွင် ထောက်ခံသည်-
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |
❮ Element Object