How to set the border color in css: 1. Use the border attribute, the syntax "border:yansezhi;"; 2. Use the border-color attribute, the syntax "border-color:yansezhi;". Color values can be defined using color names, hexadecimal values, RGB or RGBA, HSL, etc.
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
Method 1: Use border attribute
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style type="text/css"> div{ margin: 10px; border:solid #FFC0CB; } </style> </head> <body> <div>测试文字</div> <div>测试文字</div> <div>测试文字</div> </body> </html>
Rendering:
Method 2: border-color attribute
border-color attribute is used to set the color of the four borders.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style type="text/css"> div{ margin: 10px; border:solid; border-color: bisque; } </style> </head> <body> <div>测试文字</div> <div>测试文字</div> <div>测试文字</div> </body> </html>
Rendering:
The color value can be set in the following ways:
name - specify the color name , such as "red"
HEX - Specify a hexadecimal value, such as "#ff0000"
RGB - Specify an RGB value, such as "rgb(255,0,0)"
HSL - Specify the HSL value, such as "hsl(0, 100%, 50%)"
transparent
Related recommendations: "css video tutorial"
The above is the detailed content of How to set the border color in css. For more information, please follow other related articles on the PHP Chinese website!