Home  >  Article  >  Web Front-end  >  How to set the color of css table box

How to set the color of css table box

WBOY
WBOYOriginal
2021-11-26 17:23:237298browse

In CSS, you can use the "border-color" attribute to set the color of the table box. This attribute is mainly used to set the border color for elements. You only need to add "border-color: color value; "Style is enough.

How to set the color of css table box

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

How to set the color of the table box in css

In css, you can use the border-color attribute to set the border color of the table table.

border-color property sets the color of the four borders. This property can set from 1 to 4 colors.

The border-color property is a shorthand property that can set the color of the visible parts of all borders of an element, or set different colors for each of the 4 sides.

The following example explains how to set the border color of table with css. The example is as follows:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
.biaoge{
  border-color:red;
}
</style>
<table border="2" class="biaoge">
  <tr>
    <td>111</td>
    <td>222</td>
  </tr>
  <tr>
    <td>333</td>
    <td>444</td>
  </tr>
    <tr>
    <td>555</td>
    <td>666</td>
  </tr>
  <tr>
    <td>777</td>
    <td>888</td>
  </tr>
</table>
</body>
</html>

Output result:

How to set the color of css table box

(Learn Video sharing: css video tutorial)

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

Statement:
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