我们如何指定标头单元格是HTML中的列,行还是一组列或行的标头?
使用scope属性可以实现标头单元格是HTML中的列,行还是一组列或行的标头-
示例
<!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></th> <th scope = "col">Name</th> <tr> <td>1</td> <td>Sachin Tendulkar</td> </tr> <tr> <td>2</td> <td>Virat Kohli</td> </tr> </table> </body> </html>