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.
Check Opacity, You can set this css property to the div, the
<p>
or using<span>
you want to make transparentAnd by the way, the font tag is deprecated, use css to style the text
Edit: This code will make the whole element transparent, if you want to make ** just the text ** transparent check @Mattias Buelens answer
opacity
applies to the whole element, so if you have a background, border or other effects on that element, those will also become transparent. If you only want the text to be transparent, usergba
.Also, steer far, far away from
<font>
. We have CSS for that now.Your best solution is to look at the "opacity" tag of an element.
For example:
So in your case it should look something like :
However don't forget the tag isn't supported in HTML5.
You should use a CSS too :)
There is no CSS property like background-opacity that you can use only for changing the opacity or transparency of an element's background without affecting the child elements, on the other hand if you will try to use the CSS opacity property it will not only changes the opacity of background but changes the opacity of all the child elements as well. In such situation you can use RGBA color introduced in CSS3 that includes alpha transparency as part of the color value. Using RGBA color you can set the color of the background as well as its transparency.
Easy! after your:
add this one:
you just have to change the ".6" for a decimal number between 1 and 0
Just use the
rgba
tag as your text color. You could useopacity
, but that would affect the whole element, not just the text. Say you have a border, it would make that transparent as well.