Two HTML tables side by side, centered on the page

前端 未结 10 1597
小蘑菇
小蘑菇 2020-12-25 12:10

I have two tables on a page that I want to display side by side, and then center them within the page (actually within another div, but this is the simplest I could come up

10条回答
  •  生来不讨喜
    2020-12-25 12:36

    The problem is that you need to give #inner a set width (anything but auto or inherit). The margin: 0 auto; trick only works if the inner element is narrower than its container element. Without being given a width, #inner is automatically expanding to the full width of #outer, which causes its contents to be flush left.

提交回复
热议问题