
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Use HTML Tag Inside HTML Table
We can easily add HTML tag inside a table. The HTML tag should be placed inside the <td> tag. For example, adding a paragraph <p>?</p> tag or other available tags inside the <td> tag.
Syntax
Following is the syntax to use an HTMl tag inside HTML table.
<td> <p> Paragraph of the context</p> <td>
Example 1
Given below is an example to use an HTML tag inside HTML table.
<!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>
Following is the output for the above example program.
We can also add other HTML tags inside HTML tables.
Example 2
Following is the syntax to use an HTML tag inside HTML table.
<!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>
Following is the output for the above example program.
Example 3
Another example to use a HTML tag inside a HTML table is seen as following ?
<!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>
Advertisements