使用<caption>标记将标题添加到表中。您可以尝试运行以下代码以在HTML中包含表格标题-
在这里,我们添加了一个表标题“ Indian Cricketers”-
<!DOCTYPE html> <html> <head> <style> table, th, td { border: 1px solid black; } </style> </head> <body> <h2>Cricketers</h2> <table style = "width:100%"> <caption>Indian Cricketers</caption> <th>Name</th> <tr> <td>Sachin Tendulkar</td> </tr> <tr> <td>Virat Kohli</td> </tr> </table> </body> </html>