如何使背景色透明

时间:2018-11-11 06:11:08

标签: css

如何使用CSS使背景颜色部分透明,我想让背景颜色部分显示背景图像。enter image description here

<div id="border101"> 
    <center><img src="img/logo.jpg" height="120px"></center>
    <hr> 
    <p style="background-color: white; font-size: 20px;" align="left"> 
        Welcome to cryptofreeonline.ga we have many site in different formats. 
        We made this site with some basic help from the owners over at 
        <a href="blackccgen.ga">Blackccgen</a>
    </p> 
</div>


#border101 { 
border: 10px solid silver; 
margin-left: 100px; 
margin-right: 100px; 
border-radius: 30px 30px 30px 30px; 
margin-top:30px; 
height: 650px; 
background-color: #C64CD5; 
}

2 个答案:

答案 0 :(得分:1)

使用rgba(将opacity设置为backgrounda

我使用https://www.w3schools.com/colors/colors_converter.asp

hex的颜色转换为rgb

#border101 { 
border: 10px solid silver;
margin-left: 100px; 
margin-right: 100px; 
border-radius: 30px 30px 30px 30px; 
margin-top:30px; height: 650px; 
background-color: rgba(198, 76, 213,0.5); 
}
<div id="border101"> 
    <center><img src="img/logo.jpg" height="120px"></center>
    <hr> 
    <p style="background-color: white; font-size: 20px;" align="left"> 
        Welcome to cryptofreeonline.ga we have many site in different formats. 
        We made this site with some basic help from the owners over at 
        <a href="blackccgen.ga">Blackccgen</a>
    </p> 
</div>

答案 1 :(得分:0)

使用此颜色

background-color:#ff341140;

颜色代码中的最后两个数字是透明的,这里是40