Skip to main content
Engineering LibreTexts

6.4: Image Transparency

  • Page ID
    93817
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Image Transparency/Opacity

    With CSS you can change the transparency/opacity of images to enhance the look of your page. Currently, Internet Explorer 8 and earlier use a different technique for applying image transparency than Firefox, Chrome, and other Internet browsers. Style properties for the browsers are shown in the table below.

    Property: Value Description
    opacity x
    x can be a value between 0.0 - 1.0.
    A lower value makes the element more transparent.
    Changes the transparency/opacity of an image.
    This property is supported by all major browsers including IE9 and later.
    filter:alpha(opacity=x)) x
    x can be a value from 0 - 100.
    A lower value makes the element more transparent
    Changes the transparency/opacity of an image. ** Currently this property is used only by IE8 and earlier versions.
    Figure \(\PageIndex{1}\): Properties and values for image transparency/opacity. ("MGA Web Development Tutorials" by Floyd, Kevin; Kwak, Myungjae; and Stines, Alan, Computer Science and Information Technology Ancillary Materials. 4GALILEO Open Learning Materials is licensed under CC BY-SA 4.0)

    The following example demonstrates how to use the transparency properties in both IE and other browsers

        <body style="background-image:url(stonehenge1.jpg);"
        background-repeat:repeat;font:10pt arial">"
    
    
        <div style="width:400px;height: 180px;margin: auto;"
        background-color: #ffffff;border: 1px solid black;
        padding:10px;filter:alpha(opacity=60);opacity:0.6">"  
    
        <p>
        A background image is specified with the background-image:url(url) 
        property, where the location of the image file is given by its url 
        address. If the image file is stored in the same location as the page, 
        only the file name need be coded. If no other style settings are 
        made pertaining to the background image, it is repeated horizontally 
        and vertically, across and down the container, to fill the background 
        with the image.
        </p>
        </div>
        </body>
        
        Screenshot 2023-03-29 at 1.13.28 PM.png
    
    Figure \(\PageIndex{2}\): Transparency/Opacity Example ("MGA Web Development Tutorials" by Floyd, Kevin; Kwak, Myungjae; and Stines, Alan, Computer Science and Information Technology Ancillary Materials. 4GALILEO Open Learning Materials is licensed under CC BY-SA 4.0)

    6.4: Image Transparency is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by LibreTexts.

    • Was this article helpful?