Home > Article > Web Front-end > How to use HTML tags in HTML tables?
We can easily add HTML tags to the table. HTML tags should be placed within
…
tag or other available tags within aThe following is the syntax for using HTMl tags in HTML tables.
<td> <p> Paragraph of the context</p> <td>
An example of using HTML tags in an HTML table is given below.
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> table,tr,th,td { border:1px solid black; } </style> </head> <body> <table style="width: 50%"> <caption style="text-align: center; ">Employees</caption> <tr> <th >EmployeeName</th> <th >About Employee</th> </tr> <tr> <td >Yadav</td> <td ><p>Lokesh yadav is a content developer at tutorialspoint.</p></td> </tr> <tr> <td>Abdul</td> <td ><p>Abdul is a content developer at tutorialspoint.</p></td> </tr> </table> </body> </html>
The following is the output of the above example program.
We can also add other HTML tags to the HTML table.
The following is the syntax for using HTMl tags in HTML tables.
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> table,tr,th,td { border:1px solid black; } </style> </head> <body> <table style="width: 50%"> <caption style="text-align: center; ">Employees</caption> <tr> <th>EmployeeName</th> <th>Languages Known</th> </tr> <tr> <td>Yadav</td> <td><ul> <li>HTML</li> <li>Java</li> <li>C</li> </ul></td> </tr> <tr> <td>Abdul</td> <td ><ul> <li>C#</li> <li>Java</li> <li>C</li> </ul></td> </tr> </table> </body> </html>
The following is the output of the above example program.
Another example of using HTML tags in HTML tables is as follows -
<!DOCTYPE html> <html> <head> <style> table, th, td { border: 1px solid black; width: 400px; } </style> </head> <body> <h1> Total Points</h1> <table> <tr> <th>Technologies</th> <th>Points</th> </tr> <tr> <td>Programming Languages <ul> <li>C++</li> <li>Java</li> <li>C</li> </ul> </td> <td>100</td> </tr> <tr> <td>Database <ul> <li>MySQL</li> <li>Oracle</li> <li>CouchDB</li> </ul> </td> <td>50</td> </tr> </table> </body> </html>
The above is the detailed content of How to use HTML tags in HTML tables?. For more information, please follow other related articles on the PHP Chinese website!