gpt-3.5-turbo-0125· openai
Suzhen/CodeChat
Give me code for a 2 column and 3 row HTML table
- User
Give me code for a 2 column and 3 row HTML table
- Assistant
Sure! Here is an example of HTML code for a 2 column and 3 row table:
<!DOCTYPE html> <html> <head> <title>2 Column, 3 Row Table</title> </head> <body> <table border="1"> <tr> <td>Row 1, Column 1</td> <td>Row 1, Column 2</td> </tr> <tr> <td>Row 2, Column 1</td> <td>Row 2, Column 2</td> </tr> <tr> <td>Row 3, Column 1</td> <td>Row 3, Column 2</td> </tr> </table> </body> </html>This code will create a simple HTML table with 2 columns and 3 rows, each filled with some sample text. You can customize the content within each cell to suit your needs.
- User
With table head
- Assistant
Sure! Here is an example of HTML code for a 2 column and 3 row table with a table header:
<!DOCTYPE html> <html> <head> <title>2 Column, 3 Row Table with Table Head</title> </head> <body> <table border="1"> <thead> <tr> <th>Column 1</th> <th>Column 2</th> </tr> </thead> <tbody> <tr> <td>Row 1, Column 1</td> <td>Row 1, Column 2</td> </tr> <tr> <td>Row 2, Column 1</td> <td>Row 2, Column 2</td> </tr> <tr> <td>Row 3, Column 1</td> <td>Row 3, Column 2</td> </tr> </tbody> </table> </body> </html>In this code, the
<thead>tag is used to define the header of the table, containing the column titles. The data rows are enclosed within the<tbody>tag. This structure ensures that the table header is displayed separately from the data rows.