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/css-properties/border-collapse-answer.php below:

Website Navigation


CSS Properties: How to set the collapsing borders model for a table?

CSS Properties: How to set the collapsing borders model for a table?Last update on February 17 2024 12:46:23 (UTC/GMT +8 hours)

Go to Exercise page

Solution:

HTML Code:

<!DOCTYPE html><!-- Declaration of HTML5 document type -->
<html>
<head>
<style>/* CSS style start*/
table {
border-collapse: collapse; /* Specifies the border collapse behavior for the table */
}
table, td, th {
border: 1px solid red; /* Sets a red solid border with 1px width for table, td, and th elements */
}
</style>
</head>
<body>
<table><!-- Start of the table -->
<tr><!-- Start of the table row -->
<th>First Name</th><!-- Table header cell containing "First Name" -->
<th>Last Name </th><!-- Table header cell containing "Last Name" -->
</tr><!-- End of the table row -->
<tr><!-- Start of another table row -->
<td>Jack</td><!-- Table data cell containing "Jack" -->
<td>Bell</td><!-- Table data cell containing "Bell" -->
</tr><!-- End of the table row -->
<tr><!-- Start of another table row -->
<td>Peter</td><!-- Table data cell containing "Peter" -->
<td>Jhon</td><!-- Table data cell containing "Jhon" -->
</tr><!-- End of the table row -->
</table><!-- End of the table -->
</body>
</html>

Explanation:

Live Demo:

See the Pen border-collapse-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