How to make border transparent in css

藏色散人
Release: 2023-01-06 11:12:54
Original
5639 people have browsed it

How to make the border transparent in css: first create an HTML sample file; then create a div in the body; finally set the "border-top:10px solid rgba(200,200,200,0.25);" style to the div, that is Makes the specified border transparent.

How to make border transparent in css

The operating environment of this article: windows7 system, HTML5&&CSS3 version, DELL G3 computer

Transparency is generally considered to be a color attribute, but there is no such numerical value. We have found the best way to make div transparent. Using RGBA

RGBA adds parameters to control alpha transparency based on RGB. There are three parameters: R (red), G (green), and B (blue). The positive integer value range is: 0 – 255 or the percentage value range is: 0.0% – 100.0%. Values outside the range are rounded to the nearest value limit. Not all browsers support using percentage values. A parameter, the value is between 0 and 1, and cannot be negative

RGBA syntax example:

.div {background: rgba(200,200,200,0.5);}
Copy after login

Next, we will demonstrate how to make the border transparent:

Give div Set the following style:

div { width: 100px; height:100px; border-top:10px solid rgba(200,200,200,0.25); border-right:10px solid rgba(200,200,200,0.5); border-bottom: 10px solid rgba(200,200,200,0.75); border-left:10px solid rgba(200,200,200,1);}
Copy after login

The display effect is as shown in the figure, with different transparency on each side. When we need to set the transparency of the border, just fill in the last value between 0-1 as needed.

How to make border transparent in css

Learning video sharing:css video tutorial

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

Related labels:
css
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
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!