HTML DOM Element offsetHeight 属性
- အဆင်းအတန်း အရှေ့ပိုင်း normalize()
- နောက်ပိုင်း စာကြိုး offsetWidth
- အဆင်းအတန်း ပြန်သွား HTML DOM Elements အပြား
定义和用法
offsetHeight
属性返回元素的可视高度(以像素为单位),包括内边距、边框和滚动条,但不包括外边距。
offsetHeight
属性是只读的。
请参阅:CSS 框模型教程
offsetParent
所有块级元素都报告相对于偏移父级的偏移量:
- offsetTop
- offsetLeft
- offsetWidth
- offsetHeight
偏移父级指的是最近的具有非静态位置的祖先。
ချို့တဲ့ ခွင့်ပြုချက် မရှိဘဲ အရွယ်အစား သည် အခြေခံ စာတမ်း အတွင်း ကို စစ်ဆေးသည်
ကျမ်းကို ကြည့်ပါ:
အမှတ်
အမှတ် 1
ပြပြီး "myDIV" အကျယ်အဝန်း နှင့် အကျယ်အဝန်း ကို ပေါ်လစ်မှာ ပေးသည်: အကျယ်အဝန်း နှင့် ပတ်ဝန်းကျင် ပါဝင်သည်
const elmnt = document.getElementById("myDIV"); let text = "အကျယ်အဝန်း နှင့် ပတ်ဝန်းကျင်: " + elmnt.offsetHeight + "ပမာဏ<br>"; text += "Width with padding and border: " + elmnt.offsetWidth + "px";
အမှတ် 2 အကျိုးသက်ရောက်မှု
clientHeight/clientWidth နှင့် offsetHeight/offsetWidth အကွဲအပြားလျားနှင်းကွန်းခုံး ရှိ
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";
လျားနှင်းကွန်းခုံး မရှိ
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";
အဓိပ္ပာယ်
element.offsetHeight
တင်ပြချက်
အမျိုးအစား | ဖော်ပြ |
---|---|
နှစ် | အရာဝတ္တု အမြင့် အပိုင်းအခြာ (ပမာဏ: ပိုင်းအားကျူးကွန်း) အတွက် ပါဝင်သည်။ ပြင်ပ အကျယ်အဝန်း၊ အကျယ်အဝန်း နှင့် လျားနှင်းကွန်းခုံး။ |
ဘရောက်ကွန်း ထောက်ပံ့
အားလုံး ဘရောက်ကွန်း ကူးကြောင်း element.offsetHeight
:
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
ထောက်ပံ့ | ထောက်ပံ့ | ထောက်ပံ့ | ထောက်ပံ့ | ထောက်ပံ့ | ထောက်ပံ့ |
- အဆင်းအတန်း အရှေ့ပိုင်း normalize()
- နောက်ပိုင်း စာကြိုး offsetWidth
- အဆင်းအတန်း ပြန်သွား HTML DOM Elements အပြား