Enhancing Your Site with WebKit
WebKit is an open source browser engine. Apple uses WebKit in Safari, Mail, and other applications. Google’s Chrome browser, along with the S60 browser and the iPhone browser, is also built on WebKit. Some of the cool features of WebKit is transitions and transforms. With purely CSS you can create stunning animations. Your site will still work in other browsers, but the users with WebKit browsers will just get a slightly better experience.
Take for example Elliot Jay Stocks’ new website, elliotjaystocks.com. It is in it self a very beautiful website, but if you open it in e.g. Safari 4, it’s even more beautiful. When you hover your mouse over the images, the border will slowly fade into a lighter color. In non-WebKit browsers, it’ll just be a very sudden transition. This done solely by CSS.
Another example is Atebits’ website. Atebits is the company behind the Twitter app Tweetie. Let’s have a look at their front page:
That’s just beautiful, huh? Well, let’s dive into how we easily can add similar function to our own site.
The first property we have to learn is -webkit-transition. The -webkit-transition property is a shortcode for the three properties -webkit-transition-property, -webkit-transition-duration and -webkit-transition-timing-function.
We’ll probably learn this the best by having a look at an example, so here goes: We want to create a div that, when hovered, fades into another color. Here’s the code:
div { -webkit-transition: background-color, color 0.4s linear; background-color: #777777; } div:hover { background-color:#999999; }
And here’s the example:
This wasn’t so hard, was it? Now let’s move on to using the -webkit-transform property. It allows you to scale, rotate, translate, and skew the object. It even allows you to use matrices for advanced transformations. Let’s try to rotate and skew the div from before:
div { -webkit-transition: all 0.4s linear; background-color: #777777; } div:hover { -webkit-transform: scale(1.3) skew(3deg); background-color:#999999; }
This is just a little glimpse into what you can do with WebKit. Hopefully, you’ll find it useful.
i55iqj8amt


Taha
December 17, 2009 at 7:33 amThanks that is very unique post. Never heard about it
Vats Thakur
September 7, 2009 at 9:28 pmnice post, thanks! keep posting…
Kim H
July 8, 2009 at 12:40 amWow.. That’s really neat; I’ve never seen these effects done by CSS before, just jQuery and JavaScript. I’d love to eventually use them – perhaps in the future. The skew is especially neat.
Peter
July 6, 2009 at 8:45 amHi there,
Thank you for the nice comments and suggestions. For your pleasure, I have removed the text shadowing in the body text. On my screen it was not an issue, but I sure don’t want anyone to not to be able to read the articles, so thank you very much.
freese
July 5, 2009 at 8:55 pmNice article! Thank you for it. A little suggestion for your website. Everything looks pretty sweet ind here, the only problem for me, is actually reading the content of your page. The text shadow declared in nizzle.css : text-shadow: 0 1px 1px #555555 on line 19 makes it really complicated for me, at least with this monitor, to read the text. Maybe the contrast is just not high enough. Just my 2 cents. Keep on blogging.ffffffffffff
Tanc
July 5, 2009 at 9:27 amCool, some nice effects there. I’m having some trouble with your text shadow on the body copy of your site though, it makes reading the text harder.
Ahmad Alfy
July 5, 2009 at 1:40 amI’m stunned!
I’ve never seen these effects before!! It works also on Chrome effectively. I think this is something I’ll be using on my future project
Thanks!