Why is the Bootstrap grid layout preferable to an HTML table?

后端 未结 9 807
生来不讨喜
生来不讨喜 2021-01-31 01:30

[Note: for those who may be confusing this question with \"why not use tables for HTML layout\", I am not asking that question. The question I\'m asking is why is a grid layout

9条回答
  •  南方客
    南方客 (楼主)
    2021-01-31 02:05

    While there's not necessarily much semantic difference between the two sets of markup (since the classes used by Bootstrap's grid system are indeed purely presentational), one very important distinction is that the grid system is much more flexible.

    It would be very difficult, for example, to make your table-based layout respond to different screen sizes. There's no way to tell the browser to display one td element below another td in the same row. Whereas with the div example, that's easy to do, and the same markup can be presented in different ways even when the classes are "presentational" in the sense that they define the relative proportions and positioning of the elements on the page.

提交回复
热议问题