Home  >  Article  >  Web Front-end  >  How to set text transparent background opaque using css

How to set text transparent background opaque using css

青灯夜游
青灯夜游Original
2021-03-31 14:47:002696browse

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>

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)

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!

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