gpt-3.5-turbo-0613· openai
Suzhen/CodeChat
is it better to use tables or divs when i need to create too complex table? or maybe…
- User
is it better to use tables or divs when i need to create too complex table? or maybe there is another way to do this in html? give examples of this
- Assistant
When creating a complex table, it is generally recommended to use HTML tables rather than divs, as tables are specifically designed for tabular data and offer better semantic structure. However, using divs along with CSS for layout purposes is also a common practice. Ultimately, the decision depends on the specific requirements of your project.
Here are examples of both approaches:
Using HTML tables:
html<table> <thead> <tr> <th>Header 1</th> <th>Header 2</th> <th>Header 3</th> </tr> </thead> <tbody> <tr> <td>Row 1, Column 1</td> <td>Row 1, Column 2</td> <td>Row 1, Column 3</td> </tr> <tr> <td>Row 2, Column 1</td> <td>Row 2, Column 2</td> <td>Row 2, Column 3</td> </tr> </tbody> </table>