此问题在此处已有答案:
How do I give text or an image a transparent background using CSS?(29个答案)
3天前关闭。
HTML当我运行这段代码时,它向我显示了背景和文本透明度降低
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
#h1{
background-color: rgb(81, 5, 151);
opacity: 0.8;
}
</style>
</head>
<body>
<h1 id="h1">Change only background opacity not text. When I am run this code it has shown me both opacity decrease background and text.<y /h1> Here I have taken h1 and give id
</body>
</html>
1条答案
按热度按时间6psbrbz91#
通过减小此值(如0.7或0.5)将帮助您更改背景图像的透明度或不透明度