我想从中获取元素高度document,我正在尝试使用const header = document.getElementsByClassName(myClass). 但是在转换为 时存在一些Element问题HTMLElement。是否有一些方法可以HTMLElement从构建string或获得attributes类似offsetHeightfrom HTMLCollection?
const myheader = document.getElementsByClassName(myClass);
console.info(myHeader[0].offsetHeight);