+ Reply to Thread
Results 1 to 8 of 8

Thread: Good gradient shadow code, or drop shadow

  1. #1
    ZeptOr's Avatar
    ZeptOr is offline x10 Sophmore ZeptOr is an unknown quantity at this point
    Join Date
    Sep 2005
    Posts
    221

    Good gradient shadow code, or drop shadow

    I'm looking for a good way to make a gradient shadow/dropshadow in both Firefox and IE. I made a gradient transparent shadow in PNG, and it looks good in Firefox (You can see it http://greenear.x10hosting.com/Main/index4.html, on the sides of my site) but it doesn't work in IE because its a PNG and transparency doesnt show in PNG formats for IE.

    Whats a good way to do this? I tried gif in photoshop, but it i cant get the gradient transparency to work in gif format.

    Help.. Please?

  2. #2
    Colin's Avatar
    Colin is offline x10 Elder Colin is an unknown quantity at this point
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    992

    Re: Good gradient shadow code, or drop shadow

    I don't think there is an actual way to code a dropshadow etc. Your best bet is to wait for everyone to have IE7 and hope that it works.
    Xbox Live Gamertag: hyperphoenix89
    --- + Current + ---

    --- + Current #2 + ---

  3. #3
    karhukat is offline x10Hosting Member karhukat is an unknown quantity at this point
    Join Date
    Jun 2006
    Posts
    76

    Re: Good gradient shadow code, or drop shadow

    You might want to try one of the IE png hack's. Here's one http://homepage.ntlworld.com/bobosola/index.htm. I've never used it but looking at the examples it seems to work. I'm sure there are other similar hacks if you do a search.

    Alternatively, couldn't you use a IE conditional comment, to use a image without the shadow for IE6 and below. As people upgrade to IE7, they will see the shadow but until then at least they wouldn't see the white where the transparency is supposed to be.
    Last edited by karhukat; 11-09-2006 at 12:20 PM.

  4. #4
    ZeptOr's Avatar
    ZeptOr is offline x10 Sophmore ZeptOr is an unknown quantity at this point
    Join Date
    Sep 2005
    Posts
    221

    Re: Good gradient shadow code, or drop shadow

    so there isnt anyway to do it? I know i have seen sites before that have it

  5. #5
    karhukat is offline x10Hosting Member karhukat is an unknown quantity at this point
    Join Date
    Jun 2006
    Posts
    76

    Re: Good gradient shadow code, or drop shadow

    I think the javascript hack I linked in my first post will work if they have javascript enabled.

    Also, here is a link to a css workaround that you could try.

    http://www.daltonlp.com/daltonlp.cgi...=1&item_id=217
    Last edited by karhukat; 11-09-2006 at 06:14 PM.

  6. #6
    ZeptOr's Avatar
    ZeptOr is offline x10 Sophmore ZeptOr is an unknown quantity at this point
    Join Date
    Sep 2005
    Posts
    221

    Re: Good gradient shadow code, or drop shadow

    I am trying the javascript hack, but it isn't working

    It says on their website that you have to specify the image width and height, but i don't know where

    here is the code, where do I put in the height/width?

    PHP Code:
      <!--[if lt IE 7]>
        <
    script language="JavaScript">
            function 
    correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
            
    {
            var 
    arVersion navigator.appVersion.split("MSIE")
            var 
    version parseFloat(arVersion[1])
            if ((
    version >= 5.5) && (document.body.filters)) 
              {
                for(var 
    i=0i<document.images.lengthi++)
                {
                    var 
    img document.images[i]
                    var 
    imgName img.src.toUpperCase()
                    if (
    imgName.substring(imgName.length-3imgName.length) == "PNG")
                    {
                        var 
    imgID = (img.id) ? "id='" img.id "' " ""
                        
    var imgClass = (img.className) ? "class='" img.className "' " ""
                        
    var imgTitle = (img.title) ? "title='" img.title "' " "title='" img.alt "' "
                        
    var imgStyle "display:inline-block;" img.style.cssText 
                        
    if (img.align == "left"imgStyle "float:left;" imgStyle
                        
    if (img.align == "right"imgStyle "float:right;" imgStyle
                        
    if (img.parentElement.hrefimgStyle "cursor:hand;" imgStyle
                        
    var strNewHTML "<span " imgID imgClass imgTitle
                        
    " style=\"" "width:" img.width "px; height:" img.height "px;" imgStyle ";"
                        
    "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                        
    "(src=\'" img.src "\', sizingMethod='scale');\"></span>" 
                        
    img.outerHTML strNewHTML
                        i 
    i-1
                    
    }
                }
              }    
            }    
            
    window.attachEvent("onload"correctPNG);
         
    </script>
      <![endif]--> 
    Last edited by ZeptOr; 11-09-2006 at 06:37 PM.

  7. #7
    karhukat is offline x10Hosting Member karhukat is an unknown quantity at this point
    Join Date
    Jun 2006
    Posts
    76

    Re: Good gradient shadow code, or drop shadow

    Sorry, I missed that. I don't think that this will work for you afterall, it wants the width and height set in the img tag and you aren't using one because it's a background. Will the css hack work for you? I'll see if I can find anything else. Sorry.

  8. #8
    DecemberGuild is offline x10 Sophmore DecemberGuild is an unknown quantity at this point
    Join Date
    Oct 2006
    Posts
    107

    Re: Good gradient shadow code, or drop shadow

    I have an idea. Try that CSS hack. You can create a small DIV. Make the background black, and use the Alpha filter to fade it to transparent. This works on IE.

    Edit: Don't use the one he linked. The standard "Filter:Alpha" should work on all browsers.
    http://www.fred.net/dhark/demos/css/..._examples.html

    Edit: Here-
    Filter:Alpha(Opacity=100, FinishOpacity=0, Style=1, StartX=0, StartY=0, FinishX=580, FinishY=0) (Edit the lines in red.)
    Last edited by DecemberGuild; 11-09-2006 at 09:03 PM.

+ Reply to Thread

Similar Threads

  1. Hybrid's HTML Lessons
    By Hybrid in forum Tutorials
    Replies: 18
    Last Post: 11-28-2009, 02:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers