如何降低HTML,CSS中的背景透明度?[duplicate]

wnavrhmk  于 2022-12-09  发布在  其他
关注(0)|答案(1)|浏览(140)

此问题在此处已有答案

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>
6psbrbz9

6psbrbz91#

通过减小此值(如0.7或0.5)将帮助您更改背景图像的透明度或不透明度

相关问题