How to set the color of table border in css

王林
Release: 2021-06-08 15:56:57
Original
4387 people have browsed it

The way to set the table border color in css is to add the border-color attribute to the table border and set the color of the table border as needed, such as [border-color:#ff0000 #0000ff;].

How to set the color of table border in css

The operating environment of this article: windows10 system, css 3, thinkpad t480 computer.

We often need to modify the color of the table border at work, so how do we achieve this effect in CSS? It’s actually very simple, let’s take a look below.

Use attributes:

border-color attribute sets the four border colors of an element.

Attribute value:

  • color Specifies the background color.

  • transparent Specifies that the color of the border should be transparent. This is the default

  • inherit Specifies the color of the border, which should be inherited from the parent element

Code example:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title></title>
<style>
p.one
{
	border-style:solid;
	border-color:#0000ff;
}
p.two
{
	border-style:solid;
	border-color:#ff0000 #0000ff;
}
p.three
{
	border-style:solid;
	border-color:#ff0000 #00ff00 #0000ff;
}
p.four
{
	border-style:solid;
	border-color:#ff0000 #00ff00 #0000ff rgb(250,0,255);
}
</style>
</head>

<body>
<p class="one">One-colored border!</p>
<p class="two">Two-colored border!</p>
<p class="three">Three-colored border!</p>
<p class="four">Four-colored border!</p>
</body>
</html>
Copy after login

Running results As shown in the picture:

How to set the color of table border in css

Related video sharing: css video tutorial

The above is the detailed content of How to set the color of table border in css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!