How to change text transparency in HTML/CSS?

text opacity css
css transparent text see through background
css background opacity without affecting text
css background image opacity without affecting text
background-color opacity css
border opacity css
html transparent color
transparent box css

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.

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.

CSS opacity property, The beauty is that you can pair it with -webkit-text-fill-color: transparent; This is real web text, so with that comes all the accessibility and searchability and easy-​to-change-ness and all that. Which you could use right in HTML anywhere. Note: When using the opacity property to add transparency to the background of an element, all of its child elements become transparent as well. This can make the text inside a fully transparent element hard to read. If you do not want to apply opacity to child elements, use RGBA color values instead (See "More Examples" below).

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

opacity, How do you change the opacity of text in CSS? In addition to RGB, you can use an RGB color value with an alpha channel (RGBA) - which specifies the opacity for a color. An RGBA color value is specified with: rgba(red, green, blue, alpha). The alpha parameter is a number between 0.0 (fully transparent) and 1.0 (fully opaque). Tip: You will learn more about RGBA Colors in our CSS Colors Chapter.

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.

        font-family: Garamond, serif;
        font-size: 12px;
        color: rgba(0, 0, 0, 0.5);

How To Do Knockout Text, -level, where 1 is not transparent at all, 0.5 is 50% see-through, and 0 is completely transparent. You can use CSS to play with opacity and transparency! With a few simple keystrokes, you can instantly change how an element looks on your page.

Your best solution is to look at the "opacity" tag of an element.

For example:

    filter:alpha(opacity=40); /* For IE8 and earlier */

So in your case it should look something like :

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

However don't forget the tag isn't supported in HTML5.

You should use a CSS too :)

How to Create an Image with Transparent Text Using CSS, Making a div vertically scrollable using CSS · How to give a div tag 100% height of the To set the opacity only to the background and not the text inside it. There is really no property the same as transparency in CSS. However, you can produce the transparency effect by using the CSS3 opacity property. The opacity property is used to specify the transparency of an image or a text. This property is used to adjust the transparency of a text or picture. The number ranges between 0 and 1.

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

Transparent Background Images, trns-text css and change the image to your choice. Don't forget to copy the trns-​text html or change the class. 7. ​. CSS Image Opacity (Transparency) In CSS, there is no property such as transperancy. But, you can achieve transparancy by inserting a pseudo element with regular opacity the exact size of the element behind it. The CSS3 property for transparency is opacity and it is a part of the W3C CSS3 recommendation.

Set the opacity only to background color not on the text in CSS , If by “transparent” you mean “invisible” then you can add any of the following you want text that can be seen through, then you need to set the opacity to a but its not cool if you want to start to build something cool dont use css like that Set the opacity only to background color not on the text in CSS. The opacity property is used in the image to describes the transparency of the image. The value of opacity lies between 0.0 to 1.0 where the low value represents high transparent and high value represents low transparent.

Transparent Text (CSS), Then, use the opacity CSS property to set a transparent image or text. The opacity DOCTYPE html> <html> <head> <title>Title of the document</title> <​style>  When we opt for Background opacity property of CSS for an HTML element generally what happen is it will not only change the opacity of image in background but also reflects the opacity changes in its child elements. The default initial value for opacity is 1(100% opaque). But this tutorial will guide you how to handle this property effectively.

How to make transparent text in HTML, CSS3's opacity property makes it easy to change the opacity of images, text, <div​> s, and DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>CSS3  To make the caption opaque (and easier to read) when the mouse hovers over it, you can use the :hover pseudo-class to change opacity to 1 on hover. Open the HTML page in a browser and hover your mouse over the caption to see it change.

  • A far superior solution compared to the accepted answer, IMO. You do not need to add an additional span element to the HTML to apply opacity solely to the text.
  • This is the solution.
  • what browsers are "old" in this sense?
  • @RickDavies According to, IE9 or higher is required. If you need to support IE8, you still need the fallback. Otherwise, you should be fine with just rgba.
  • Hmmmm, neither is the opacity property. Wow.
  • Use the <span>, Luke!
  • This answer is incorrect. Its code makes entire element (div) translucent. The Question specified only the text. The higher-voted sibling answer should be the accepted one.
  • Thank you. It really helped me hiding a text in my wordpress template. Instead of (opacity: 0.5;) I just used (opacity:0;).