下面代码,我 .focus 明明写的 721,获取的宽度为什么是 722 呢(第一次 721,一刷新就是 722)?有老师能详细的解释下吗
我的 Chrome 版本是:74.0.3729.157(正式版本) (64 位)
.w {
width: 1200px;
margin: 0 auto;
}
.main {
width: 980px;
height: 455px;
margin-left: 219px;
margin-top: 10px;
background-color: red;
}
.focus {
position: absolute;
/* position: relative; */
width: 721px;
height: 455px;
overflow: hidden;
background-color: pink;
}
333
console.log(document.querySelector('.focus').offsetWidth);