Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: image fading

  1. #1
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    image fading

    Hi guys,
    I've look'd around but can't find the answer.

    I'd like the extremities (about 20px) of an image to fade out gradually revealing the underneath background.

    There is a "simple" way to achieve this with css?

    Many thanks in advance,
    nivlat

  • #2
    Registered User
    Join Date
    Jun 2011
    Posts
    1,063
    Thanks
    12
    Thanked 241 Times in 240 Posts
    Quote Originally Posted by nivlat View Post
    I'd like the extremities (about 20px) of an image to fade out gradually revealing the underneath background.
    Going off of akrocatering, you could use css transitions, which are uber easy.

    Code:
    .background {
        background: #bbb;
    }
    .fade-out {
        opacity: 1;
        filter: alpha(opacity=100); /* IE */
        -webkit-transition: opacity 2s;
           -moz-transition: opacity 2s;
             -o-transition: opacity 2s;
                transition: opacity 2s;
    }
    .fade-out:hover {
        opacity: .6;
        filter: alpha(opacity=60);  /* IE */
    }
    Code:
    <div class="background">
        <img src="url.jpg" class="fade-out" />
    </div>
    Opacity Article
    CSS Transitions
    Last edited by Sammy12; 09-15-2012 at 09:24 PM.

  • #3
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks for the anwers, but I'm not looking for a "hover" effect, I need it to be a static, permanent effect.
    any other ideas?
    thanks

  • #4
    Regular Coder
    Join Date
    Jul 2008
    Posts
    157
    Thanks
    9
    Thanked 13 Times in 13 Posts

    Png -24

    Open image in editing program such as Photoshop. Use Marquee tool to select part of image you want opaque, copy/paste that opaque portion onto new layer, lower opacity of original layer below, merge layers, FILE>Save for Web>PNG-24

    Alternatively could erase portion to be faded with tool opacity w=set to 25% or such.
    Attached Thumbnails Attached Thumbnails image fading-eriks111510.jpg  
    Last edited by waxdoc; 09-15-2012 at 11:59 PM. Reason: add image sample

  • #5
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thank you all for replies.
    I think I probably expressed my problem in a bad way.

    Let's say I have a background for my html (image A) and a background for my body (image B) wich is 800px wide. I want the edges of B to disappear, gradually revealing A, regardless of monitor resolution or body position. So I can't use photoshop or such because B is not always on the same position relatively to A.
    Is this possible?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •