Home>Article>Web Front-end> How to set the transparency of the border in css

How to set the transparency of the border in css

青灯夜游
青灯夜游 Original
2021-04-29 11:31:29 16353browse

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.

How to set the transparency of the border in css

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:

     
测试文本,透明度0.1
测试文本,透明度0.5
测试文本,透明度0.8
测试文本,透明度1.0

Rendering:

How to set the transparency of the border in css

##Description:

border-color attribute can Set the border color, and the RGBA() function can set the color transparency.

RGBA means (Red-Green-Blue-Alpha) which is an extension of RGB to include the "alpha" channel, which allows you to set transparency on color values.

Syntax:


rgba(R,G,B,A);

Introduction to the values in rgba():


  • R: red value. Positive integer (0~255)

  • G: green value. Positive integer (0~255)

  • B: Blue value. Positive integer (0~255)

  • A: Transparency. The value is between 0 and 1

(Learning video sharing:

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!

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
Previous article:How to set css in jq Next article:How to set css in jq