Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-15-2012, 05:53 PM   PM User | #1
nivlat
New to the CF scene

 
Join Date: Sep 2012
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
nivlat is an unknown quantity at this point
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
nivlat is offline   Reply With Quote
Old 09-15-2012, 08:18 PM   PM User | #2
Sammy12
Registered User

 
Join Date: Jun 2011
Posts: 1,063
Thanks: 12
Thanked 241 Times in 240 Posts
Sammy12 is on a distinguished road
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 08:24 PM..
Sammy12 is offline   Reply With Quote
Old 09-15-2012, 08:58 PM   PM User | #3
nivlat
New to the CF scene

 
Join Date: Sep 2012
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
nivlat is an unknown quantity at this point
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
nivlat is offline   Reply With Quote
Old 09-15-2012, 10:57 PM   PM User | #4
waxdoc
Regular Coder

 
Join Date: Jul 2008
Posts: 155
Thanks: 9
Thanked 13 Times in 13 Posts
waxdoc is an unknown quantity at this point
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
Click image for larger version

Name:	eriks111510.jpg
Views:	10
Size:	15.5 KB
ID:	11553  

Last edited by waxdoc; 09-15-2012 at 10:59 PM.. Reason: add image sample
waxdoc is offline   Reply With Quote
Old 09-15-2012, 11:58 PM   PM User | #5
nivlat
New to the CF scene

 
Join Date: Sep 2012
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
nivlat is an unknown quantity at this point
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?
nivlat is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:16 AM.


Advertisement
Log in to turn off these ads.