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.
我在一个div中有两个跨度。我想将它们彼此对齐。我通过左右浮动它们来做到这一点。问题是这些跨度具有可变高度(当您单击“更多选项”时它们会向下滑动)。因此,当它们的高度在运行时(通过向下滑动)发生变化时,它们不会向下推它们下面的元素。如果有一种方法可以在不浮动它们的情况下对齐它们,那将起作用。
也许在这些跨度之后带有“clear:both”的元素可以解决您的问题?
将overflow:auto或overflow:hidden放在您的 div 上。这将强制 div 调整到内部浮动内容的大小。
overflow:auto
overflow:hidden
冒着获得大量反对票的风险,请使用<table>?
<table>