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

Detailed explanation of ECharts mouse event processing method

An event is an action performed by the user or th...

Implementing a simple timer based on Vue method

Vue's simple timer is for your reference. The...

mysql 8.0.19 win10 quick installation tutorial

This tutorial shares the installation tutorial of...

Analysis and solution of data loss during Vue component value transfer

Preface In the previous article Two data types in...

How to install PostgreSQL11 on CentOS7

Install PostgreSQL 11 on CentOS 7 PostgreSQL: The...

Zabbix implements monitoring of multiple mysql processes

Three MySQL instance processes are started on one...

Detailed explanation of overflow:auto usage

Before starting the main text, I will introduce s...

3 ways to add links to HTML select tags

The first one : Copy code The code is as follows: ...

Detailed explanation of CSS style cascading rules

CSS style rule syntax style is the basic unit of ...

How to use Web front-end vector icons

Preface When writing front-end pages, we often us...

js drag and drop table to realize content calculation

This article example shares the specific code of ...

How to construct a table index in MySQL

Table of contents Supports multiple types of filt...

JavaScript type detection method example tutorial

Preface JavaScript is one of the widely used lang...

Example of implementing TikTok text shaking effect with CSS

In daily development, front-end students often ar...