HTML table border control implementation code

HTML table border control implementation code

Generally, when we use a table, we always give it a border attribute, such as: <table border="1">, the effect is as follows:

ID NAME GENDER
1001 mike male

You can see that the border of the table seems to be very wide. Of course, the "very wide" here is definitely not the width of the table border. The width you see is probably due to the gaps between the <td> tags. Therefore, you only need to modify the cellspacing attribute of the table, that is: <table border="1px" cellspacing="0px">, the effect is as follows:

ID NAME GENDER
1001 mike male

However, it seems that the width is not as wide as we imagined: only one pixel wide. In fact, what you see in the above picture is actually two pixels wide. Why? This is because the borders between <td> do not overlap. Just modify the border-collapse property of the table.

That is, <table border="1px" cellspacing="0px" style="border-collapse:collapse">

ID NAME GENDER
1001 mike male

Add a color to the table, <table border="1px" bordercolor="#000000" cellspacing="0px" style="border-collapse:collapse">

ID NAME GENDER
1001 mike male

<<:  Solution to the Docker container cannot be stopped and deleted

>>:  Complete step record of vue encapsulation TabBar component

Recommend

jQuery plugin to achieve image comparison

This article example shares the specific code of ...

How to monitor and delete timed out sessions in Tomcat

Preface I accidentally discovered that the half-h...

What is jQuery used for? jQuery is actually a js framework

Introduction to jQuery The jQuery library can be ...

A complete guide to clearing floats in CSS (summary)

1. Parent div defines pseudo-classes: after and z...

Detailed explanation of how to use eslint in vue

Table of contents 1. Description 2. Download rela...

Detailed explanation of the order of JS object traversal

Some of you may have heard that the order of trav...

Implementation of the login page of Vue actual combat record

Table of contents 1. Preliminary preparation 1.1 ...

SQL implementation of LeetCode (197. Rising temperature)

[LeetCode] 197.Rising Temperature Given a Weather...

JavaScript Sandbox Exploration

Table of contents 1. Scenario 2. Basic functions ...

MySQL sequence AUTO_INCREMENT detailed explanation and example code

MySQL sequence AUTO_INCREMENT detailed explanatio...

Detailed steps for manually configuring the IP address in Linux

Table of contents 1. Enter the network card confi...