CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   HTML & CSS (http://www.codingforums.com/forumdisplay.php?f=13)
-   -   image fading (http://www.codingforums.com/showthread.php?t=273213)

nivlat 09-15-2012 05:53 PM

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

Sammy12 09-15-2012 08:18 PM

Quote:

Originally Posted by nivlat (Post 1270230)
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

nivlat 09-15-2012 08:58 PM

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

waxdoc 09-15-2012 10:57 PM

Png -24
 
1 Attachment(s)
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.

nivlat 09-15-2012 11:58 PM

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?


All times are GMT +1. The time now is 10:46 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.