CSS3 features you can start using now

Written by That Web Guy on 1st September 2009. 13 comments

CSS3 features you can start using now
  • Avant Innovations
  • Advertise Here

Although CSS3 isn't mainstream enough that we can adopt it wholly without regard, we can however start using it knowing that it will degrade gracefully enough with minimal impact on our designs.

Aside from beginning your familiarisation process with CSS3, another advantage is that as more browsers start to support it, users with supported browsers (Firefox and Webkit based browsers at time of this blog post) will start noticing the nicer ‘changes' you've made to your web site.

If you want to take advantage of some of the cool stuff made possible by CSS3, by all means start doing it now. Here's a few you can start using immediately.

Rounded corners

These look particularly nice on form fields, but of course you can also use them on other HTML elements. If the browser doesn't support CSS3 the user will simply see standard squared corners. The chances are you have been using square corners on your divs and form fields anyway so there's no love lost, but now they will look much nicer in supported browsers.

rounded_corners.gif

-moz-border-radius: 5px; /* The radius for Mozilla */
-webkit-border-radius: 5px; /* The radius for Webkit */

Multiple columns

Once the domain of printed media, multi column content areas can look right at home on a web page as well, and CS3 will let you do it without the need to place each column floating in a div. What happens in an unsupported browser? Thankfully nothing to drastic. The text will just appear as a standard paragraph. But you will just need to bear that in mind when you design the page. FYI, as far as I know this only works in Firefox.

multi_columns.gif

-moz-column-count: 3; /* Number of columns */
-moz-column-gap: 1em; /* Space between each column */
-moz-column-rule: 1px solid black; /* Colour of the border between the columns */

Box shadows

Bye-bye transparent PNG's: It's been nice knowing you. Actually transparent PNG's will always have a use in modern web design, but the CSS3 Box shadow property means they won't be needed to create a drop shadow under a modal box. As with everything else mentioned in this article, graceful degradation occurs and in this case, and the user simply won't see the drop shadow.

Note that the box shadow requires at least 3 values to work but no more than 4.

box_shadow.gif

width: 250px;
padding: 10px;
-webkit-box-shadow: 7px 7px 10px #ccc; /* The coordinates of the shadow, blur radius, and the colour (Webkit) */
-moz-box-shadow: 7px 7px 10px #ccc; /* The coordinates of the shadow, blur radius, and the colour (Mozilla) */

Update: box-shadow has been removed from the CSS3 spec.

Text shadow

Once the domain of Photoshop noobs during the last millennium, thanks to CSS3 drop shadows on text are back to haunt every self respecting designer. Seriously though, this one will get abused like you won't believe and once the Management sees it, they will want it on everything. Let's keep it our little secret.

text_shadow.gif

font-size:2em; /* Font size */
text-shadow: 2px 2px 3px #999; /* Coordinates, blur radius, colour */

Fonts

While it's still not a typographers dream, CSS3 does provide far greater control over type. The ability to use any font on your site will also open up a huge can of legal worms, so to avoid any legal hassles it might be best to only use fonts that are free. And with fonts you've purchased, you might want to check if the licence extends to you using it on the web in this manner.

font_face.gif

Using a font is as easy as:

@font-face {
font-family: "Days"; /* The name of the font sans the extension (to be referenced further down in your style sheet when required) */
src: url("Days.otf") format("opentype"); /* The path to the font, absolute or in this case, relative to the document */
}

h1 {
font-size:1.6em; /* The font size */
font-family: "Days", Helvetica, Sans-Serif; /* Remember that reference to the font I made earlier? This is it. */
}

Mixing it all up

Now you can try and be a bit more creative. The example below shows some of the CSS3 elements demonstrated earlier in one single containing div.

mixed.gif

That wasn't so hard now was it? Consider this your first very basic introduction to CSS3. Of course there's a lot more to it than I've shown here, but these will get you started before you move onto something a bit more complex. By the way, here's a sample I prepared earlier:

css3_demo.zip (2k)

Is this worth sharing?

That Web Guy

About That Web Guy

That Web Guy (Mikey to his friends) is a veteran web designer based in Perth, Western Australia, and currently Design Director at Perth Web Design. When he's not XHTML'ing or messing around in Photoshop, Mikey can usually be found preaching web standards evangelism onto unsuspecting victims.

Feel free to send That Web Guy a message some time, follow him on Twitter, or make a donation.

Comments

Not a Member

Anderson

The font-face is the most appealing out of these. Thanks for the nudge and I reckon it's about time I started using some of this stuff.

Wednesday 2nd September 2009 | 07:51 AM Reply Comment URL Back to top

Not a Member

Anders

BTW why did you use images instead of the actual css3???

Wednesday 2nd September 2009 | 07:53 AM Reply Comment URL Back to top

That Web Guy

That Web Guy

Responding to this comment by Anders

Thanks Mr Anderson - I used images so that people viewing this page on browsers without CSS3 support can see what happens.

Wednesday 2nd September 2009 | 07:57 AM Reply Comment URL Profile Back to top

Not a Member

Jillinity D.

Will font-face work with true type fonts?

Love your work.

Wednesday 2nd September 2009 | 09:16 AM Reply Comment URL Back to top

CSS Babe

CSS Babe

Excellent stuff once again. Q: Would search engines be able to pick up on the font used? To me it would seem easy for the author of a Helvetica for example to search for sites using that font.

Wednesday 2nd September 2009 | 05:23 PM Reply Comment URL Profile Back to top

Harun Smrkovic

Harun Smrkovic

OH MAN!
Thanks for the tips ;)

I am so excited :) :) I personally think the font option is the best yet.

Thursday 3rd September 2009 | 03:53 AM Reply Comment URL Profile Back to top

That Web Guy

That Web Guy

Responding to this comment by CSS Babe

I don't think so. I just tried to search for my style sheet through Google and it found nothing - even when I type in the direct path. As far as I know, search engines ignore style sheets, but they pay attention to inline CSS.

Thursday 3rd September 2009 | 06:01 AM Reply Comment URL Profile Back to top

Not a Member

CSS Gallery

Great list. Thank you for the info. I still seem see errors come up with validation for those things even when CCS3 is selected.

Saturday 5th September 2009 | 06:19 AM Reply Comment URL Back to top

Harun Smrkovic

Harun Smrkovic

I see you've added shadow to your titles :D
Way to go (Y)

Thursday 10th September 2009 | 06:14 PM Reply Comment URL Profile Back to top

That Web Guy

That Web Guy

Responding to this comment by Harun Smrkovic

...and to links in the article :-)

Thursday 10th September 2009 | 06:56 PM Reply Comment URL Profile Back to top

Harun Smrkovic

Harun Smrkovic

Man, I can't make this work :(
I uploaded your example with my truetype font and it just loaded sans serif instead of Harabara.ttf :D :D
:(

Saturday 12th September 2009 | 09:36 PM Reply Comment URL Profile Back to top

That Web Guy

That Web Guy

Responding to this comment by Harun Smrkovic

Maybe try making the path to the file absolute? Upload a zip somewhere if you want me to have a look at it. Or chat with me on my new instant messenger account: messenger@thatwebguyblog.com

Sunday 13th September 2009 | 06:23 AM Reply Comment URL Profile Back to top

Not a Member

Sivaranjan

This is an incredible post. Its amazing to see what CSS3 can do , at the same time its sad a lot of customers still want IE support which sucks at CSS3 big time. I am taking the liberty of adding this article to my CSS aggregator site. Hope you dont mind. :)

Thursday 3rd June 2010 | 01:49 AM Reply Comment URL Back to top

FYI: You are currently not logged in. It's cool though - you can still comment. But only members get a profile page, access to the download section and they can pimp their own web sites. Feel free to register or Login now!

Your name:

Your comments:

Note: HTML tags are automatically stripped from comments.

Are you human?
Turing

Sorry, I have to ask. So what sort of animal is this? (Hint: you don't have to be perfectly specific)

Back to top

Login to That Web Guy Blog

Login

Not registered? | Forgot your Password? Cancel Login