How to change text transparency in HTML/CSS?

2019-01-05 00:23发布

I'm very new to HTML/CSS and I'm trying to display some text as like 50% transparent. So far I have the HTML to display the text with full opacity

<html><font color=\"black\" face=\"arial\" size=\"4\">THIS IS MY TEXT</font></html>

However, I'm not sure how to change its opacity. I've tried looking online, but I'm not sure exactly what to do with the code I find.

标签: html css opacity
8条回答
beautiful°
2楼-- · 2019-01-05 01:20

What about the css opacity attribute? 0 to 1 values.

But then you probably need to use a more explicit dom element than "font". For instance:

<html><body><span style=\"opacity: 0.5;\"><font color=\"black\" face=\"arial\" size=\"4\">THIS IS MY TEXT</font></span></body></html>

As an additional information I would of course suggest you use CSS declarations outside of your html elements, but as well try to use the font css style instead of the font html tag.

For cross browser css3 styles generator, have a look at http://css3please.com/

查看更多
甜甜的少女心
3楼-- · 2019-01-05 01:21

try to play around with mix-blend-mode: multiply;

color: white;
background: black;
mix-blend-mode: multiply;

MDN

tutorial

查看更多
登录 后发表回答