Computer Science, asked by sanjubala8654, 1 year ago

How to create tables in HTML

Answers

Answered by SparshGupta
5
Tables can be made by using these simple tags.
Use the HTML <table> element to define a table.
Use the HTML <tr> element to define a table row.
Use the HTML <td> element to define a table data.
Use the HTML <th> element to define a table heading.
Use the HTML <caption> element to define a table caption.
Hope this may help you..
Answered by AnjaliSapkota191
2

To create table in HTML, use the <table> tag. A table consist of rows and columns, which can be set using one or more <tr>, <th>, and <td> elements. A table row is defined by the <tr> tag. To set table header, use the <th> tag. For a table cell, use the <td> tag.

Just keep in mind, table attributes such as align, bgcolor, border, cellpadding, cellspacing deprecated and isn’t supported by HTML5. Do not use them.

You can try the following code to create a table in HTML. We’re also using the <style> tag to style the table border

Example

<!DOCTYPE html>

<html>

  <head>

     <style>

        table, th, td {

           border: 1px solid black;

        }

     </style>

  </head>

  <body>

     <h1>Programming Languages</h1>

     <table>

        <tr>

           <th>Language</th>

           <th>Release Year</th>

        </tr>

        <tr>

           <td>Java</td>

           <td>1995</td>

        </tr>

        <tr>

           <td>Pascal</td>

           <td>1970</td>

        </tr>

     </table>

  </body>

</html>

Similar questions