Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何计算 yui3 中元素的宽度(以像素为单位)?我已经尝试过.getComputedStyle("width"),.get('offsetWidth')但都没有返回正确的结果,可能是因为 div 上没有设置 CSS 宽度。
.getComputedStyle("width")
.get('offsetWidth')
它在这里对我来说工作正常,你能提供一个失败的例子吗?
也许您期望它包含填充/边框?JQuery 的 .width() 也不包括那些,但也许这就是混乱所在。