Home > Article > Web Front-end > How to set the transparency of the border in css
In css, you can set the border transparency through the border-color attribute and the RGBA() function. Just add the "border-color: rgba (red, green, blue, transparency value)" style to the border element. border-color can set the border color, and RGBA() can set the color transparency.
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
css sets the transparency of the border
In css, the border transparency can be set through the border-color attribute and the RGBA() function.
Code example:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <style type="text/css"> div{ border:10px solid; margin: 10px 0; } </style> </head> <body> <div style="border-color: rgba(0,153,0,0.1);">测试文本,透明度0.1</div> <div style="border-color: rgba(0,153,0,0.5);">测试文本,透明度0.5</div> <div style="border-color: rgba(0,153,0,0.8);">测试文本,透明度0.8</div> <div style="border-color: rgba(0,153,0,1.0);">测试文本,透明度1.0</div> </body> </html>
Rendering:
rgba(R,G,B,A);Introduction to the values in rgba():
css video tutorial)
The above is the detailed content of How to set the transparency of the border in css. For more information, please follow other related articles on the PHP Chinese website!