Home > Article > Web Front-end > How to set background transparency in html
In HTML, if it is a background color, you can use the rgba() function or opacity attribute to set the color transparency; if it is a background image, you can use the opacity attribute and "filter:opacity(%)" style to set it Image transparency.
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
1. Set the transparency of the background color--use the rgba() function or the opacity attribute
Example 1:
RGB 颜色,并使用透明度:
红色
绿色
蓝色
灰色
黄色
樱桃色
Rendering:
Example 2:
背景色不透明,文字不透明!
背景色透明,文字也透明!
Rendering:
2. Set the transparency of the background image--use the opacity attribute and "filter:opacity(%)" style
Example 1:
原图:
透明度为50%:
透明度为20%:
Example 2:
原图:
透透明度为0.5:
透明度为02:
(Learning video sharing: css video tutorial, "html video tutorial")
The above is the detailed content of How to set background transparency in html. For more information, please follow other related articles on the PHP Chinese website!