Hi, dear readers!
Today I’d like to share with you an extremely simple cross-browser implementation of the CSS property “box-shadow”. The method is so simple and obvious that I was greatly surprised not to find a similar solution anywhere on the Web (though I’m absolutely positive that I’m not the first one to discover it).
Let’s start with CSS for “normal” browsers.
background: green; /* must use for IE */
-webkit-box-shadow: 0px 0px 15px #222;
-moz-box-shadow: 0px 0px 15px #222;
box-shadow: 0px 0px 15px #222;
The box-shadow implementation for IE is done by applying a shadow filter four times, with various “direction” values, to make the shadow frame the container.
Please pay attention to the details:
- The shadow that you make by applying a filter is darker than desired. To make it look more authentic, try tuning up the “color” and the “strength”.
- Keep in mind that IE increases the block size by the shadow width. And as we basically use two shadows for each side, the actual increase is double the shadow width. Therefore, remember to shift the block leftward and upward by the value calculated using the following formula: left = top = – (strength * 2)
- IE6 and IE7 require hasLayout, so set zoom: 1 (width, height, or other property assigned to hasLayout)
- Make sure to set the background, otherwise the filter will be applied to child elements.
- Using filters always means an extra slowdown when a webpage is being rendered
- IE disables text smoothing within a block to which filters are applied
- The shape of a shadow in IE differs from that in other browsers: It’s more square-like
That’s all for now. Thanks for reading!
Showcase of 30 Funny 3D Characters
With the use of some of the 3D tools it’s possible to create really impressive effects. One can make his characters...March 25, 2016
Fresh Toolbox for Web Developers – August 2015
Web developers should always be aware of the current news. In order to help them in their work brilliant web developers...March 23, 2016
Tips for designing models for 3D printing
It’s clear that 3D printing is not just another curiosity that will generate a hype and then fall into oblivion –...March 22, 2016
30 WordPress Themes for Many Types of Business
Looking for an awesome WordPress theme for your business on the net? It may be a rather time-consuming occupation if you...March 20, 2016
Collection of New & Free Fonts for June 2015
Every month we showcased some great collections of free fonts and we are not going to stop there! We would like...March 19, 2016
3D Printing – A New Opportunity for Commercial Printers
In recent years, the concept of 3D printing has taken the world by storm, promising to change forever the process involved...March 18, 2016
Impact of 3d printing affecting the design industry
3D printing or Additive manufacturing is revolutionising the world. What exactly does it mean? You can get three-dimensional physical objects printed...March 17, 2016
5 High-end WordPress plugins tailored to please 3D printing fans
Just like the growing success and popularity of WordPress web development, even the 3D printing industry has witnessed an incredible amount...March 16, 2016
25 Fresh Examples of Minimalist Web Designs
Minimalistic designs in art have always been popular because they are able to convey an idea with limited resources. The sphere...March 15, 2016