Internet Explorer - CSS Shadow All Around

后端 未结 4 1074
梦如初夏
梦如初夏 2021-01-02 03:52

I have been ripping my hair out over this issue, I want a simple shadow that does around the whole element, besides for the top. I got it to work in Firefox and Chrome with

相关标签:
4条回答
  • 2021-01-02 04:29

    The shadow filter is unidirectional, and direction is a number between 1 and 360 degrees. To generate a box shadow with the ability to offset that shadow, you'll need use multiple shadow filters:

       filter: progid:DXImageTransform.Microsoft.Shadow(Color=#cccccc, Strength=5, Direction=0),
         progid:DXImageTransform.Microsoft.Shadow(Color=#cccccc, Strength=5, Direction=90),
         progid:DXImageTransform.Microsoft.Shadow(Color=#cccccc, Strength=5, Direction=180),
         progid:DXImageTransform.Microsoft.Shadow(Color=#cccccc, Strength=5, Direction=270);
    

    This is sorted top/right/bottom/left, and varying the strength on any one side will alter the size of that shadow. For example, 2 5 5 10 will produce a straight-down drop shadow that gives the illusion of height.

    0 讨论(0)
  • 2021-01-02 04:31

    Similar to Above Answer (See Note Below):

    #boxContainer{ 
       filter:
            progid:DXImageTransform.Microsoft.Shadow(Strength=3, Direction=0, Color='#000000'),
            progid:DXImageTransform.Microsoft.Shadow(Strength=3, Direction=90, Color='#000000'),
            progid:DXImageTransform.Microsoft.Shadow(Strength=3, Direction=180, Color='#000000'),
            progid:DXImageTransform.Microsoft.Shadow(Strength=3, Direction=270, Color='#000000');
    }
    

    Important: Keep in mind there's also a bug in IE where it will apply that same style to child elements. So you may need to apply a "counter"/"Nullifier" if you will.

    Example:

    #boxContainer button, #boxContainer div, #boxContainer span {
      /* Nullify Inherited Effect - Set "Strength=0" */
      filter:
        progid:DXImageTransform.Microsoft.Shadow(Strength=0, Direction=0, Color='#000000'),
        progid:DXImageTransform.Microsoft.Shadow(Strength=0, Direction=90, Color='#000000'),
        progid:DXImageTransform.Microsoft.Shadow(Strength=0, Direction=180, Color='#000000'),
        progid:DXImageTransform.Microsoft.Shadow(Strength=0, Direction=270, Color='#000000');
    }
    
    0 讨论(0)
  • 2021-01-02 04:41

    there are solutions here: http://www.artlebedev.com/tools/technogrette/html/filters-in-ie/ combining the glow and blur filters which look significantly better, to quote one of the code samples on the page above:

    .shadowed .shadow-3
    {
    filter: progid:DXImageTransform.Microsoft.Glow(Color=#000000,Strength=1.0)
    progid:DXImageTransform.Microsoft.Alpha(opacity=25)
    progid:DXImageTransform.Microsoft.Blur(pixelradius=1.75, enabled='true');
    -ms-filter: "progid:DXImageTransform.Microsoft.Glow(Color=#000000,Strength=1.0)"
    "progid:DXImageTransform.Microsoft.Alpha(opacity=25)"
    "progid:DXImageTransform.Microsoft.Blur(pixelradius=1.75, enabled='true')";
    color: #111111;
    top: -2px;
    left: -2px;
    }
    
    0 讨论(0)
  • 2021-01-02 04:47

    Try the "glow" filter instead:

    http://msdn.microsoft.com/en-us/library/ms532995(v=VS.85).aspx

     DIV.aFilter {
        filter:progid:DXImageTransform.Microsoft.Glow(Color=blue,Strength=5);
        width: 150px;}
    
    0 讨论(0)
提交回复
热议问题