How to change text transparency in HTML/CSS?
Just use the rgba
tag as your text color. You could use opacity
, but that would affect the whole element, not just the text. Say you have a border, it would make that transparent as well.
.text
{
font-family: Garamond, serif;
font-size: 12px;
color: rgba(0, 0, 0, 0.5);
}
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, use rgba
.
#foo {
color: #000; /* Fallback for older browsers */
color: rgba(0, 0, 0, 0.5);
font-size: 16pt;
font-family: Arial, sans-serif;
}
Also, steer far, far away from <font>
. We have CSS for that now.
Check Opacity, You can set this css property to the div, the <p>
or using <span>
you want to make transparent
And by the way, the font tag is deprecated, use css to style the text
div {
opacity: 0.5;
}
Edit: This code will make the whole element transparent, if you want to make ** just the text ** transparent check @Mattias Buelens answer