Search code examples
cssbackground-colortransparent

How to make div background color transparent in CSS


I'm not using CSS3. So I can't use opacity or filter attributes. Without using these attributes how can I make the background-color transparent of a div? It should be kind of the text box example in this link. Here the text box background color is transparent. I want to make the same, but without using the above mentioned attributes.


Solution

  • Opacity gives you translucency or transparency. See an example Fiddle here.

    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";       /* IE 8 */
    filter: alpha(opacity=50);  /* IE 5-7 */
    -moz-opacity: 0.5;          /* Netscape */
    -khtml-opacity: 0.5;        /* Safari 1.x */
    opacity: 0.5;               /* Good browsers */
    

    Note: these are NOT CSS3 properties

    See http://css-tricks.com/snippets/css/cross-browser-opacity/