If You’re Not Using Webkit You’re Doing It Wrong
Time for a sweeping statement. If you’re not using a webkit browser, Apple Safari or Google Chrome, you’re doing it wrong! And you’re missing out on a lot of special features. Not just on this website but on a whole host of others.
So, what are some of the advantages of using a -webkit browser I hear you ask? Well, within this article I will do a small case study on this website to let you see some of the things that -webkit can offer.
The Logo
When you hover over my logo you should notice two things happening. First you will notice the animation that is flipping the logo upside down and the second thing you will notice is the logo decreasing in size. Now, you might not be very impressed with either of these techniques as they are easily achievable with javascript but what if I were to tell you that these were infact created with css?
To achieve this I have implemented an effect called webkit-transform, available in browsers driven by the webkit rendering engine(Chrome and Safari). The code in my stylesheet looks like the following
header a img {-webkit-transition: all 0.15s ease-out;}
header a:hover img,
header a:focus img {-webkit-transform: scale(0.7) rotate(180deg);}
The first part of the code tells the transition to last a set amount of time, 0.15, and for the effect to move smoothly (ease-out) and the second part of the code, the a:hover and a:focus, tells the element to scale to 0.7 of it’s size and rotate 180 degrees.
Background Gradient
Background gradients are quite the rage but what if you could display a gradient without the use of an image? Well surprise, surprise with webkit you can.
background: #EAEAEA;
background: -webkit-gradient(linear, left top, left bottom, from(#FFF),
to(#A1A1A1), color-stop(1, #A1A1A1));
The above piece of code is what I originally had implemented on my website but more about that in the next step. You will notice that I have specified two background properties, the first background property is for a fall back option for browsers that don’t support the webkit engine and the second call only applying to webkit browsers.
First you specify that you wish to use the webkit-gradient on the background element and within the brackets you can then specify the properties you wish to use. Linear defines the way the gradient displays, another option you can choose is radial, and left top to left bottom defines the direction of the gradient. The last section tells the browser the colour you wish to start and finish on.
However shortly after I pushed my redesign live with the code above, someone suggested an alternative.
background: #EAEAEA;
background: -webkit-gradient(linear,left top,left bottom,from(#fff),
to(#a1a1a1),color-stop(1,#a1a1a1)) fixed no-repeat 0 100%;
This code does all of the same of the previous version but this time the gradient does not scroll the full length of your content, instead it will only last the length of the browser window.
Some people will suggest that you specify the -webkit code above the fallback statement so that you are making less calls.
Menu Buttons
My main menu buttons have also been created in exactly the same way as the background-gradient. This is a subtle effect that when combined with a text-shadow you can create a pretty realistic button without the use of an image.
What else can webkit offer?
Above I’ve tried to give you a little introduction into the world of -webkit, little pieces of code that can be sprinkled throughout your websites. However, if we look at the opposite end of the spectrum, some of the possibilities that -webkit can offer are outstanding.
- Doctor Who Intro
- Star Wars Atat
All funny buggers asking if this works in Internet Explorer 6 will be shot at dawn.
-
Who I am
My name is Jack Osborne and I am a Glasgow–based designer and writer. You should follow me on Twitter.
-
What I do
I am a front-end developer with proficiency in; accessibility, design, semantics, usability & web standards.
-
Where I do it
I am currently working freelance and I am available for hire. Feel free to get in touch with me if you fancy a chat.
Your site does indeed have lots of loveliness to be discovered, Jack! And I always admired how technically solid it is.
I’ve actually just released my new website yesterday – it was long overdue a re-write. I’m using CSS3 transitions for navigation and a few other bits of loveliness. My old site was alright, and the non-web savvy users may not prefer this new one of mine – but it’s not them I’m really targeting anyway. I’m much happier with my new one because it’s more me, and it’s technically pretty solid, and clean – a big part of the reason for my re-write.
Do you support IE6 at all now? I’m using a jQuery plugin to ask users to upgrade if any IE6 users roll up onto my site now. I’d rather they seen an upgrade window on screen with options, than poke around a lesser version of my website.
But does this work in IE6?
Seriously though, I get really frustrated wanting to use new features like these knowing that up to 30% of the people out there still actually use IE6 and even more use the more recent versions that still don’t support CSS3.
to Alan Hughes
Altough you have a point in your speech, i believe in two things:
- We should be pushing the web towards the future, and to use CSS3 it’s one of those little things that will force people to realize that it’s time to upgrade their browser.
-People who use IE6 (which doesn’t even support png transparency) surely aren’t really concerned about aesthetics! Let’s face it… the web is ugly with IE!