Home  >  Article  >  Web Front-end  >  How to set transparent background in css

How to set transparent background in css

coldplay.xixi
coldplay.xixiOriginal
2021-03-16 14:16:5712419browse

How to set a transparent background in css: first get the desired color value; then convert the RBG value into a numerical value; finally set the value to css and set the transparency. The code is [background-color:rgba (220,38,38,0.2);}].

How to set transparent background in css

The operating environment of this tutorial: windows7 system, css3 version, DELL G3 computer.

How to set a transparent background in css:

1. Get the color value you want.

How to set transparent background in css

2. Convert the RBG value into a numerical value, that is, convert a hexadecimal value into a decimal number

   dc = 220  
   26 = 38
   26 = 38

3. Set the value to css, And set the transparency

.title_div{width: 100%;
height: 30px; 
line-height: 30px;
text-align: center;
color:white; 
background-color:rgba(220,38,38,0.2);}
<div class="title_div">
    设备初始化设置
    </div>

4, the effect will come out

How to set transparent background in css

##Related learning recommendations:

css tutorial

The above is the detailed content of How to set transparent background in 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