A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.w3resource.com/html-css-exercise/basic/td-headers-answer.php below:

Website Navigation


HTML5: How to specify one or more header cells a cell is related to?

HTML5: How to specify one or more header cells a cell is related to?Last update on February 14 2024 12:55:28 (UTC/GMT +8 hours)

Go to Exercise page

Solution:

HTML Code:

<!DOCTYPE html><!-- Define document type as HTML -->
<html><!-- Begin HTML document -->
<head><!-- Start of document header -->
<meta charset="utf-8"><!-- Define character encoding -->
<title>How to specify one or more header cells a cell is related to</title><!-- Title of the HTML page -->
<style><!-- Start of CSS style block -->
table, th, td { /*Style rule to set border for table, th, and td elements */
border: 1px solid black; /* Border property with 1px solid black */
}
</style><!-- End of CSS style block -->
</head><!-- End of document header -->
<body><!-- Start of document body -->
<table style="width:100%"><!-- Table element with inline style to set width to 100% -->
<tr><!-- Table row element -->
<th id="uid">User Id</th><!-- Table header cell for column "User Id" with id attribute "uid" -->
<th id="name">User Name</th><!-- Table header cell for column "User Name" with id attribute "name" -->
<th id="address">Address</th><!-- Table header cell for column "Address" with id attribute "address" -->
<th id="phone">Phone No</th><!-- Table header cell for column "Phone No" with id attribute "phone" -->
</tr><!-- End of table row -->
<tr><!-- Table row element -->
<td headers="uid">U001</td><!-- Table data cell with content "U001" related to header cell with id "uid" -->
<td headers="name">Sudha Chandan</td><!-- Table data cell with content "Sudha Chandan" related to header cell with id "name" -->
<td headers="address">99,J.C.Bose Road,kal-125042</td><!-- Table data cell with content "99,J.C.Bose Road,kal-125042" related to header cell with id "address" -->
<td headers="phone">5612445470</td><!-- Table data cell with content "5612445470" related to header cell with id "phone" -->
</tr><!-- End of table row -->
</table><!-- End of table -->
</body><!-- End of document body -->
</html><!-- End of HTML document -->

Explanation:

Live Demo:

See the Pen td-headers-answer by w3resource (@w3resource) on CodePen.

See the solution in the browser

Supported browser

Go to Exercise page

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4