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.
block如果要确定元素的宽度,是否有一种简单的方法inline?我无法制作元素inline,所以我需要一些方法来确定它应该有多宽,然后修改宽度。
block
inline
我似乎是在多面体的帮助下完成的。如果有人在 Google 上找到它,这是代码。
$("h1").each(function() { $(this).css("display","inline").css({width: $(this).width(), display: "block"}); });