HTML Tables
An HTML table consists of rows and columns that can be used to present data in an organized format. The table consists of a <table> tag (table tag) that contains one or more <tr> tags (row tags), and each row contains one or more <td> tags (column tags) that contain the actual data. Here is an example of creating a table in HTML:
1<table><tr><th>Name</th><th> Address</th><th> Phone</th></tr><tr><td> Jukka Virtanen</td><td> Street 1, 00100 Helsinki</td><td> 010 123 4567</td></tr><tr><td> Maija Meikäläinen</td><td> Katu 2, 00100 Helsinki</td><td> 010 234 5678</td></tr></table>In this example, the table contains three columns, which are "Name", "Address", and "Phone". The first row is the header row of the table, and it contains <th> tags (header tags) used to present the header. The following rows are the data rows of the table, and they contain <td> tags (content tags) that present the data.
NOTE
Valitettavasti Replit-palvelu on muuttunut lennosta eikä enää anna suorittaa näitä koodeja suoraan selaimessa. Voit klikata alla olevaa "Open in Replit" linkkiä ja avata koodin Replit-palvelussa. Meillä on työn alla etsiä Replitille korvaaja.
thead, tbody and friends
There are also other combinations of tags that can be used to create a table, such as <thead>, <tbody>,** <tfoot>**, and <caption> tags. These are generally used to define the structure of the table and add a header and a subheader. Here is an example using the <thead> tag:
1<table><thead><tr><th>Name</th><th> Address</th><th> Phone</th></tr></thead><tbody><tr><td> Jukka Virtanen</td><td> Street 1, 00100 Helsinki</td><td> 010 123 4567</td></tr><tr><td> Maija Meikäläinen</td><td> Katu 2, 00100 Helsinki</td><td> 010 234 5678</td></tr></tbody></table>In this example, the <thead> tag contains the header row and the <tbody> tag contains the data rows. This structure helps the reader of the page (especially screen readers) to better understand the structure of the table.
Learn to hack — start here
Hundreds of interactive courses, virtual labs and CTF challenges in your browser. Start a free trial — no card required.