<div class="ccc" id="cc">
<div class="item">
1
</div>
<div class="item">
212321d s f g d s g f s d撒地方撒地方 asdf
</div>
</div>
HTML
格式化
支持Emmet,输入 p 后按 Tab键试试吧!
<head> ... </head>
<body>
</body>
body {
/* background-color: #000; */
}
.ccc{
display:flex;
width: 100px;
border: 1px solid #faa;
flex-direction: column;
height: 100px;
margin: 2px;
}
.item {
border: 1px solid #aaa;
width: 100%;
}
JS
格式化
let ccc = document.getElementById("cc")
console.log("offsetWidthdfdsfds",ccc.offsetWidth)