JavaScript, DOM operations of the acquired elements placeholder

Width, height, margin, padding, border
1. tag pattern may be obtained by
the acquired result of attribute values px Unit

window.getComputedStyle(oDiv).height

2. Other ways
offsetHeight offsetWidth
width / height padding + border +
the clientHeight the clientWidth
height / width padding +
clientLeft clientTop
left / upper border
offsetLeft offsetTop
left / upper margin
if it is set box-sizing: border-box;
border line, margin data is unaffected
clientHeight clientWidth
height / width + padding -> width / height - border
is actually defined width / height - border
the offsetHeight offsetWidth
height / width padding + border + -> width / height
width / height values is defined the actual
border lines and margins can not be set, for a style set by
the following set of grammatical forms has no effect

= oDiv.offsetHeight '300px by'; 
oDiv.clientHeight = '300px by'; 
oDiv.clientLeft = '100px'; 
oDiv.offsetLeft = '100px'; 
style can be set and boder margin 
oDiv.style.borderLeft = '100px Solid Red' ; 
oDiv.style.marginLeft = '100px';

Guess you like

Origin www.cnblogs.com/karl-kidd/p/12602604.html