CSS Side-by-Side Divs with Equal Auto Widths
Achieving equal auto widths for child DIVs within a parent DIV can be tricky with traditional float and width approaches. However, using the display: table property provides a modern solution that enables this functionality.
Solution using Display: Table
CSS Example:
#wrapper { display: table; table-layout: fixed; width: 90%; height: 100px; background-color: Gray; } #wrapper div { display: table-cell; height: 100px; }
HTML Example:
<div>
Note:
以上是如何使用 CSS 建立具有相同自動寬度的並排 Div?的詳細內容。更多資訊請關注PHP中文網其他相關文章!