国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

千鋒教育JavaScript全套視頻教程(10天學(xué)會Js,前端javascrip

2023-07-21 09:13 作者:bili_78503839732  | 我要投稿

1.1 獲取元素的寬高

1.1.1 元素的(width + padding + border)寬高: 元素.offsetWidth ;元素.offsetHeight;

var oDiv = document.querySelector(“div”);

console.log(oDiv.offsetWidth, oDiv.offsetHeight); //width + padding + border

1.1.2 元素的(width + padding )寬高:元素.clientWidth ;元素.clientHeight;

console.log(oDiv.clientWidth, oDiv.clientHeight); //width + padding

1.1.3 取元素的寬高(只能取到行內(nèi)樣式,取到的值有單位):元素.style.width ;元素.style.height;

console.log(oDiv.style.width, oDiv.style.height); //只能取到行內(nèi)樣式 取到的值有單位

1.1.3 取元素的寬高(既能取到行內(nèi),也能取到內(nèi)部和外部引入的樣式 ,取到的值有單位 ):getComputedStyle(元素)[’width’] ; getComputedStyle(元素)[’height’] ;

console.log(getComputedStyle(oDiv)[“width”]); //既能取到行內(nèi)

console.log(getComputedStyle(oDiv)[“height”]); //也能取到內(nèi)部和外部引入的樣式

1.1.3 某個DOM對象距離定位父級的左邊距(offsetLeft)和上邊距(offsetTop): 元素.offsetLeft ; 元素. offsetTop ;

//某個DOM對象距離定位父級的左邊距(offsetLeft)和上邊距(offsetTop)

console.log(oDiv.offsetLeft, oDiv.offsetTop);


千鋒教育JavaScript全套視頻教程(10天學(xué)會Js,前端javascrip的評論 (共 條)

分享到微博請遵守國家法律
桐柏县| 迁西县| 盐亭县| 阿图什市| 孝义市| 宜川县| 荥经县| 开封县| 闽侯县| 平泉县| 陇川县| 德清县| 喀什市| 麻城市| 方正县| 错那县| 长丰县| 岑巩县| 杨浦区| 定日县| 松江区| 连城县| 安多县| 延吉市| 贡觉县| 繁峙县| 内乡县| 赣州市| 临洮县| 密山市| 阿尔山市| 湛江市| 中西区| 建瓯市| 正安县| 岳普湖县| 大田县| 郸城县| 丹巴县| 于田县| 读书|