Home >Web Front-end >HTML Tutorial >How to set transparency of html font color
The transparency of the font color can be set in HTML by setting the fourth parameter a in the rgba() function, which ranges from 0 (fully transparent) to 1 (fully opaque). This works in modern browsers, but in IE 8 and earlier you can use the opacity property and the filter property to achieve the same effect.
HTML font color transparency setting
In HTML, you can use the rgba()
function to set the transparency of the font color. rgba()
The function accepts four parameters:
Among them, the a parameter represents transparency, ranging from 0 (completely transparent) to 1 (completely opaque).
How to use:
<code class="html"><p style="color: rgba(255, 0, 0, 0.5);">红色,50% 透明度</p></code>
The red text in the example above will have 50% transparency.
Note:
rgba()
function only works in modern browsers. rgba()
. opacity
property and the filter
property. Example:
<code class="html"><!-- IE 8 --> <p style="opacity: 0.5; filter: alpha(opacity=50);">红色,50% 透明度</p></code>
You can easily set any desired transparency for HTML text by using the rgba()
function.
The above is the detailed content of How to set transparency of html font color. For more information, please follow other related articles on the PHP Chinese website!