[null, null, {"document_url": "https://code.tutsplus.com/tutorials/the-intricacy-of-simplicity-css3--net-11142", "unformatted_src": "https://s3.amazonaws.com/nettuts/647_intricacyCSS3/bodyCSS.jpg", "src": "https://s3.amazonaws.com/nettuts/647_intricacyCSS3/bodyCSS.jpg", "formatted_filename": "bodyCSS", "alt_text": "Body Styling"}, null, {"document_url": "https://code.tutsplus.com/tutorials/the-intricacy-of-simplicity-css3--net-11142", "unformatted_src": "https://s3.amazonaws.com/nettuts/647_intricacyCSS3/box.jpg", "src": "https://s3.amazonaws.com/nettuts/647_intricacyCSS3/box.jpg", "formatted_filename": "box", "alt_text": "Box"}, null, {"document_url": "https://code.tutsplus.com/tutorials/the-intricacy-of-simplicity-css3--net-11142", "unformatted_src": "https://s3.amazonaws.com/nettuts/647_intricacyCSS3/rounded.png", "src": "https://s3.amazonaws.com/nettuts/647_intricacyCSS3/rounded.png", "formatted_filename": "rounded", "alt_text": "Rounded corners"}, null, {"document_url": "https://code.tutsplus.com/tutorials/the-intricacy-of-simplicity-css3--net-11142", "unformatted_src": "https://s3.amazonaws.com/nettuts/647_intricacyCSS3/borderColors.png", "src": "https://s3.amazonaws.com/nettuts/647_intricacyCSS3/borderColors.png", "formatted_filename": "borderColors", "alt_text": "Border Colors"}, null, {"document_url": "https://code.tutsplus.com/tutorials/the-intricacy-of-simplicity-css3--net-11142", "unformatted_src": "https://s3.amazonaws.com/nettuts/647_intricacyCSS3/safari.png", "src": "https://s3.amazonaws.com/nettuts/647_intricacyCSS3/safari.png", "formatted_filename": "safari", "alt_text": "In Safari"}, null, {"document_url": "https://code.tutsplus.com/tutorials/the-intricacy-of-simplicity-css3--net-11142", "unformatted_src": "https://s3.amazonaws.com/nettuts/647_intricacyCSS3/final.png", "src": "https://s3.amazonaws.com/nettuts/647_intricacyCSS3/final.png", "formatted_filename": "final", "alt_text": "Final Product"}, null, null, null, null, null, {"document_url": "https://code.tutsplus.com/tutorials/the-intricacy-of-simplicity-css3--net-11142", "unformatted_src": "https://static.tutsplus.com/assets/market/code/php_script-4741ed2bae7195fd7d74053caf84174d.png", "src": "https://static.tutsplus.com/assets/market/code/php_script-4741ed2bae7195fd7d74053caf84174d.png", "formatted_filename": "php script ed bae fd d caf d"}, null, {"document_url": "https://code.tutsplus.com/tutorials/the-intricacy-of-simplicity-css3--net-11142", "unformatted_src": "https://static.tutsplus.com/assets/market/code/javascript-b89862766072bc1ca0cffabf89aae971.png", "src": "https://static.tutsplus.com/assets/market/code/javascript-b89862766072bc1ca0cffabf89aae971.png", "formatted_filename": "javascript b bc ca cffabf aae"}, null, null, {"document_url": "https://code.tutsplus.com/tutorials/the-intricacy-of-simplicity-css3--net-11142", "unformatted_src": "https://static.tutsplus.com/assets/ecosystem/Elements-8d12ebd8ef7a8c6a1fd035134c4011f9.png", "src": "https://static.tutsplus.com/assets/ecosystem/Elements-8d12ebd8ef7a8c6a1fd035134c4011f9.png", "formatted_filename": "Elements d ebd ef a c a fd c f"}, null, {"document_url": "https://code.tutsplus.com/tutorials/the-intricacy-of-simplicity-css3--net-11142", "unformatted_src": "https://static.tutsplus.com/assets/ecosystem/Market-7e6b77007d2f2e3158f3c3279a77a143.png", "src": "https://static.tutsplus.com/assets/ecosystem/Market-7e6b77007d2f2e3158f3c3279a77a143.png", "formatted_filename": "Market e b d f e f c a a"}, null, {"document_url": "https://code.tutsplus.com/tutorials/the-intricacy-of-simplicity-css3--net-11142", "unformatted_src": "https://static.tutsplus.com/assets/ecosystem/Placeit-4b64744fed7e0608004dca545150dd77.png", "src": "https://static.tutsplus.com/assets/ecosystem/Placeit-4b64744fed7e0608004dca545150dd77.png", "formatted_filename": "Placeit b fed e dca dd"}, null, {"document_url": "https://code.tutsplus.com/tutorials/the-intricacy-of-simplicity-css3--net-11142", "unformatted_src": "https://static.tutsplus.com/assets/ecosystem/Community-e18375bc04b26732cbe441eb1c736937.png", "src": "https://static.tutsplus.com/assets/ecosystem/Community-e18375bc04b26732cbe441eb1c736937.png", "formatted_filename": "Community e bc b cbe eb c"}, null]
The Intricacy of Simplicity: CSS3

by Jeffrey Way21 Apr 2010
HTML & CSSWeb DevelopmentCSS3
This post is part of a series called CSS3 Mastery.
Quick Tip: Ever Thought About Using @Font-face for Icons?
The State of CSS3 in Email Templates

Ever wondered how a particular effect was achieved in a web design, and, after zooming in several clicks, you found that the author added several subtle shadows, borders, gradients, etc? In the past, this was achieved simply by slicing out an image, and setting it as a background of some element. Luckily, with CSS3, we can be afforded much more flexibility. Now, while the code for such a simple effect might be a bit tedious, it's well worth it, and that's what we'll review in today's written and video quick tip!

Video Version

Rather watch this screencast on Screenr.com?


It's amazing that something this simple requires that much code, but, it's not too rough, and can easily be abstracted away to a snippet for future use.

Step 1. Create the Mark-up

To make our project as cut-and-paste as possible, we're only working with an empty div. Create a new index.html file, and paste in the following:

Step 2. Create the Canvas

Next, we'll add some basic styling for the body element. This is just for the presentation, and can easily be removed. Within style tags in your header, add: Step 3. Styling the Box

Now, we'll create our box, supplying a width and height. Step 4. Rounded Corners

We should all know about CSS rounded corners by now. Let's go ahead and implement that. Note that we're also supplying the final spec, of "border-radius," in addition to Mozilla and Webkit's versions.

Step 5. Border Colors

Mozilla offers a handy property, called "-moz-border-*-colors." This allows us to set an infinite number of colors for a border. To achieve a subtle "double-border" effect, let's implement this property.

Note how the number of colors we supply are the same as the border width that we set at the beginning (2px). Also, don't place commas after each hex value; I made that mistake at first! Step 6. Compensating for Webkit

To the best of my knowledge, webkit doesn't currently support border-colors, though it's possible that I'm wrong. If I am, please leave a comment and let me know! Anyhow, to mimic this effect as best as we can in Safari and Chrome, we'll use box-shadow.

Note that the provided values refer to the X offset, Y offset, blur, and shadow color, respectively. By passing -1px as the Y offset, we can push the shadow upwards. Step 7. CSS Background Gradients

The final step is to supply a subtle background gradient for our box. However, we must be sure to provide a fallback solid color for the browsers that don't support CSS gradients.

Unfortunately, Mozilla and Webkit don't quite agree on the syntax for gradients, which makes the process extra irritating. If it's too confusing, you can use a new service called CSS3 Please to auto generate each browser's syntax; it's very cool! 
It's amazing; looking over our final image, it's hard to tell what we actually did! But this is a good thing; subtlety is key in all aspects of design. Thanks for reading/viewing!

Final Code