How to set text transparent background opaque using css

青灯夜游
Release: 2023-01-03 09:32:05
Original
2709 people have browsed it

In CSS, you can use the color attribute with the rgba() function to set the text transparent background opaque effect. The syntax format is "rgba(red, green, blue, alpha)"; among them, the parameter alpha is used to set Transparency, value between "0.0" and "1.0".

How to set text transparent background opaque using css

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

css Set text transparent background opaque

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<style type="text/css">
			div{
				background: palevioletred;
				width: 200px;
				height: 200px;
			}
			.box {
				
				color: rgba(255, 255, 255, 0.4)
			}
		</style>
	</head>

	<body>
		<div>
			<span>我是正常文字</span><br />
			<span class="box">我是透明文字</span>
		</div>
	</body>

</html>
Copy after login

Rendering:

How to set text transparent background opaque using css

css RGBA

RGBA means (Red-Green-Blue-Alpha). It is extended on RGB to include the "alpha" channel, which sets the transparency of the color value.

Syntax:

RGBA(R,G,B,A)
Copy after login

Value:

  • R: red value. Positive integer | Percent

  • G: Green value. Positive integer | Percent

  • B: Blue value. Positive integer | Percent

  • A: Alpha transparency, ranging from 0 to 1.

Recommended tutorial: CSS video tutorial

The above is the detailed content of How to set text transparent background opaque using css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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
Popular Tutorials
More>
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!