Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
276 views
in Technique[技术] by (71.8m points)

.book 加上绝对定位 absolute ,为什么clientWidth=100?

image.png

clientWidth : width + padding
.book 加上绝对定位 absolute ,为什么clientWidth=100?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

clientWidth = width + padding 没错;这里的也padding为0(不考虑浏览器默认样式)。可是width不为0啊,.book被子元素撑开了,实际宽度也变了,所以clientWidth是100(即2x50)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...