October 5, 2012

As a graphic designer for a mobile application (web and hybrid) development team, the need for styling in code comes often. Not having learned any of that in school I find myself using CSS Tricks , Stack Overflow , or whatever else google offers up. So I am taking the opportunity to offer up the snippets I find for other designers.
Why? Well anything you can accomplish in code without an image is ultimately more efficient (as far as speed is concerned) and sometimes discovering the right bit of code for those particularly tricky situations can affect the outcome of your entire day. So keep an eye out for some freshly cultivated bits of code for your design pleasure.
BOX SHADOWS
Today I want to talk about box-shadows. In css, box shadows can add that little bit of dimension that you need in all the right ways. I could go into great detail but instead I will refer you to one of my favorite resources:
http://css-tricks.com/snippets/css/css-box-shadow/
What I will give you is a brief break down on the structure of the tag itself. Its one thing to plug in some found code, its another to understand how to make it serve your purpose, well. So that being said:
box-shadow: 3px 3px 5px 6px #ccc;
box-shadow: horizontal offset vertical offset blur spread color;
(remember to always include the px unless the value is zero)
The coolest trick that I had to figure out was how to do top and bottom shadows only for a tray-like appearance.
-webkit-box-shadow: inset 0 8px 8px -8px #696868, inset 0 -8px 8px -8px #696868;
/*remember webkit doesn't work in all browsers so be sure to include the browser specific variations.*/
/*mozilla*/-moz-box-shadow: inset 0 8px 8px -8px #696868, inset 0 -8px 8px -8px #696868;
(this code was found here)
THE WAY IT WORKS.
This bit of code actually layers two box shadows on top of on another by duplicating the styling and seperating it by a comma.
This trick can serve other purposes as well by changing the color, blur, or opacity (with the use of rgba).
Hope this helps your design projects!
Feel free to contact me for questions, comments, corrections, or suggestions on topics:
contact@russpate.com
Attribution:
oh yeah the picture is from here:
http://www.flickr.com/photos/rahego/4075743721/