Today’s Readings

For lovers of Pandora, Shuffler.fm provides a similar “assumption-based” streaming service.  You pick a genre and they automatically bounce you from audio site to audio site, playing new and interesting tracks for you, all from within their portal.  It’s a great way to not only discover new and interesting music, but also new and interesting music sites.  I do believe I have found my new work muse…

To anyone having a tough time dating, here is a little chart that you should probably print out and take with you on your next date.

Maybe not quite as entertaining (or educational) as the SEO Rapper, but the CSS3 Song is pretty cool, if for no other reason than being performed with a ukulele…

YouTube: http://www.youtube.com/watch?v=5b7dNNapMCM&feature=player_embedded

Staying on the CSS bandwagon for just a sec, check-out these cool WebKit-only, CSS-only map markers (Warning: looks like ass in Firefox, and I would assume IE).  Ajaxian does a nice write-up and explanation of how this works.

Okay, just one more CSS thingy… The extremely entertaining presenter, Bruce Lawson, rants about people that bundle CSS3 into the term HTML5:

YouTube: http://www.youtube.com/watch?v=K_vF3BuWwdw&feature=player_embedded
There has been a good bit of discussion about this topic lately, and this is by no means intended as a serious contribution to that conversation.  It is meant as simple ranting entertainment.  And nicely done at that…

And finally, to all you aspiring actors out there, here is an aid to help you learn some of the most challenging dialog ever written for the big screen.

Happy reading,
Atg

Today’s Readings

In keeping with my strong belief that we should be building a unified web (not one fragmented between websites and “an app for this” and “an app for that”, etc.), I have to say I am deeply intrigued by the idea of PadPressed.

Another very useful CSS generator, CSS3 Maker, helping to make the decision whether or not to use CSS3 even easier…

Thomas Fuchs, you, Mr. Scriptaulous, points out the most expensive operation a browser conducts, and how we as developer might improve out techniques to improve user experience.

Vimeo, you rock: an embeddable video player that chooses between Flash or HTML5, definition and compression, based on the user’s set-up.  And for us WP users, they recommend using the embed iframe plug-in.

JavaScripters: read;

An Ajaxian article by Brad Neuberg highlights the tricks Flash developers could teach us HTML5ers, if only we bothered to pay attention.  After all, they’ve been doing cool visual stuff a LOT longer than we have…

Al Franken on Net Neutrality:

Best quote, I think: “We can’t let companies write the rules that they’re supposed to follow…”

And finally, ever thought of converting all your CSS and JS to a PNG, then having the client unpack that via <canvas>?  Of course, you haven’t who in the world would?  Apparently Jacob Seidelin and Alex Le would

Happy reading,
Atg

Fonts, Fonts, Everywhere, But Not a Font in Use…

Okay, brief Iron Maiden reference out of the way, now to the action…

I personally think 2010 will go down in history as the birth of the web fonts (even though the real birth was 1997, when IE4 came out).  Most likely 2011 or 2012 will really be remembered as the birth of web fonts, but those of us that were here will know the real-deal…

Between the emergence of such services as FontDeck, FontSpring, FontSquirrel, Typekit (which now offers several Adobe fonts!), Typotheque, WebType, and even Google Font Directory (this list was a LOT longer, but if the “font” service is using something like images or Flash to display your font, I cut them), and such font pioneering movements as the Bulletproof @font-face and the Mo’ Bulletproofer @Font-Face, we have finally been freed from such methods as background image replacements, Cufón and SiFR to serve new and innovative fonts to our website users.  Yes, 2010 has certainly seen tremendous progress in the world of web fonts.

So, with all of this movement, why do we still see lame (read: typical) fonts and graphic headers all over the place?  Well, it’s because the web isn’t a perfect place, and there are lots, and lots of questions still lingering out there…

Issues

Browsers implement web fonts differently from one another.  Some hide the text completely until the font file arrives then displays the styled text, others show the text in the next-highest font in the stack that is available until the font file arrives, then blinks into action (affectionately known as FOUT)…

The fonts you have to choose from used to be really horrible.  There were very few good fonts, which were expensive, and a ton of crappy fonts, which were usually free.  Recently that’s been changing (with all the font services listed above and more), but now you usually have to serve your font through the service, and some times via JavaScript.

Questions

So, can I avoid the blink, or what?  Where can I find reliable, legal fonts?  What if I don’t want to rely on some one else’s server and/or JavaScript to implement fonts?  Web fonts are really expensive aren’t they?  What happens if my font file never arrives?

Well, they’re all pretty valid comments, questions and concerns, especially if you’re running a commercial website.  Hobby sites (like the one you’re reading) don’t have to worry about how they look, in theory you’re here for the content.  But commercial sites have money on the line: either they’re selling a product or they have advertisers, and either way, they want to look consistent and professional.

So, what are the answers to these questions, and how do I go about fonting now?!

Answers

First of all, the blink…  I personally hate Firefox’s font implementation (the biggest FOUT offender).  I would rather see nothing while the browser tries to get my font file, and should only see the next font in my stack if the first one isn’t available (you know, the way font stacks are supposed to work).  But hey, that’s me, and if I really want to bitch, I should build my own browser.  In the mean time, we’re sort of stuck with it.

The best approach to fighting FOUT is to follow Paul Irish’s guidance, and put a lot of energy into building your font stack so there is a relatively not-gross common font next in line.  The biggest issue with FOUT is really the page content jumping around when the web font is finally available, so, look for a font that renders at relatively the same size, not necessarily the same look (if there was a common font that looked the same, we wouldn’t really need the web font, now would we?).

The next few issues can all be addressed at once: finding reliable, legal fonts; serving web fonts; and the cost of doing business.  First of all, there are TONS of reliable, legal fonts on the web now.  Just try scrolling through any of the above services and you’ll see more fonts than you could possibly stuff into all the websites you work on.  However, most people look at those fonts, then slooowwwllllyyy turn their eyes to the cost and…

While all of the services give you previews of the fonts, some use images or limit the text you can preview (quick brown fox, anyone?)… A cool tool to check-out what your site will look like with a particular font, prior to purchasing, is FontFonter.  Just enter the URL of your site, and pick a font.

No matter how small the cost, there is just something about having to pay for something on the web that is grating…  I know, I feel it too.  But what to do?  Well, there ARE a ton of free web fonts that can help take you and your sites far beyond the world of Helvetica, Arial, Georgia, Lucida, and Times…  Buckle up and pack a sandwich, it’s going to be a serious ride…

Yes, some are crap, but some are actually pretty cool!

The biggest concern with free fonts is quality, so be sure to thoroughly test any font for any character you might want to use (including special characters, I’ve used fonts that had several characters that were just missing…).

Finally, what to do if your font file never arrives?  Well, that’s life, and you have to plan accordingly.  This takes us back to a proper font stack.  Here are a few resources on constructing a proper font stack:

So, there it is.  Enough stuff about fonts?  Make you want to dig right in, or dig a hole and climb in it?  Hopefully the former.  Fonts can be scary, something being out of your control, but for just a dab of “something different”, not much can beat a nice, new, unfamiliar font face here and there.

If you’d like to learn more about fonts, here are a few choice resources:

If you have any fonts that you really love, or just links or notes about fonts that you’d like to share, tell us about it!

Happy fontificating,
Atg

Today’s Readings

Feeling kind of designy…

Maybe it’s the new Mac I just bought…  And by new, I mean my first… [sniffle-sniffle]

Need an old version of some software?  Get it from Oldversion.com.

I feel like there is so much to jQuery, and so many different ways to do stuff, that it can never hurt to revisit lists like Commonly Confused Bits of jQuery…  There are some really great clarifications there.

A pretty interesting tactic for making a non-JS lightbox-style image zoom.  Be sure to check out the demo, best in WebKit browsers.

I love, love, love the idea of WhitherApps.com!  They plan to take client-side mobile apps and rebuild them as pure web-apps!  Be sure to follow the progress of their first attempt, the BBC News app.

To continue with that thought

And in case you didn’t pick-up on the HTML5 vibe

Perhaps not as technologically-advanced as Aiko (but not nearly as creepy, either), is Milo.  I smell the next-generation of Sims

Right on the heals of this great news about farming on Mars, comes horrible news about the condition our muscles would be in when we finally get to Mars…  Shucks…

I know it couldn’t get much geekier than this, but 365 days of Stormtroopers? Who could resist that??

And finally, it is easy, in our modern world, in our modern lives, to fall into a lull and believe “the world is really getting better” until you see Sheryl WuDunn’s TED Talk

Happy reading,
Atg

Today’s Readings

First some good news from Google: Voice Actions for Android.  Pretty slick.

And now the bad.  Or is it?  I’m still trying to read between the lines in Google’s and Verizon’s new partnership on net neutrality…  There is a lot of information flying around about this out there, and Google is trying to sort out fact from fiction, but I’m still not convinced…  Any thoughts out there?

Last item on this issue is SitePoint’s great summation of the situation.

A great new HTML5 inspiration: HTML5Rocks

Like coding for Accessibility or good SEO, mobile-friendly sites start with good, solid HTML, but with a few extra bits, you too can build a single site that mobile-friendly.

Yet another iThing item that makes you wonder “what the hell took so long?”.

In the year… 2000…“  See ads for products from the far-off time of 2010!

Great history lesson / inspiration for you designy people out there.

And, from LessConf3010 comes Cameron Moll‘s video, Good vs. Great Design.

From the land of web fonts come some truly great, great news: Adobe partners with Typekit!

And speaking of type, ever wanted to know too much about the alphabet?  Well, I Love Typography is here to help…

And finally, this does explain why the Star Wars movies slowly degraded into disappointing movies

Happy reading,
Atg

What’s the Best Way to… Use CSS3 Today

The title of this post is meant to be taken tongue-in-cheek, meaning I do not believe there are many best anythings in this world. I do not believe in many black and white options; instead I believe most options are shades of gray. Some options are good for some situations, but do not make sense for others. Such is life. We must think, we must decide.

As such, below I will look into several options we developers have to use CSS3 today.

Let’s start by looking at what I think are the three main “philosophies” regarding the use of CSS3 today:

  1. When I can do it in all browsers, I’ll do it
    This philosophy will likely not fly well with your design department… They go through a lot of work to make those rounded corners and background gradients, and they are going to want to see those effects applied to their pages. Besides, you don’t want to be that kind of developer, do you? Not when you can do better…
  2. If some browser doesn’t understand it, too bad
    This one isn’t that different, unless you’re developing for a specific device, like an iThing, where all you have to worry about is a really recent version of Safari. Business has gotten used to all their pages looking (pretty much) the same in all browsers, and are likely to continue to expect that.
  3. I want to use CSS3, but what are my options?
    Now we’re talking! And luckily for you, there are a LOT of options! But even within this philosophy, there are still multiple scenarios that might make some options better for one situation than another. So, if you’re still with me, let’s get busy.

The options that I will be looking at are:

CSS + IE Filters

Before we get too deeply into a ton of advanced options, let’s quickly look at a pure CSS approach that works perfectly well for a small set of CSS needs.

I recently wrote a rather lengthy post, Cross-Browser CSS3 (yes, even in IE6 and IE7), with a Little Help from MS Filters, that shows how to implement several CSS3 features using nothing but CSS. Imagine. :-)

The set of features is rather short, but it is nothing but CSS, all perfectly legal, no JS required.

Here are a few other pure CSS resources:

Now on to some beefier approaches…

Dean Edwards’ IE7 (or 8, or 9)

One of the original attempts at making older browsers conform to modern CSS standards came way back when we wanted older versions of IE to behave as well as IE7! Yes, kids, there was such a time, very dark days indeed…

And Dean Edwards wrote his library to check if the browser needed help, then did what he needed to do to help it understand modern CSS (things like parent/child and sibling indicators, pseudo-class, etc.). He later updated IE7.js to match IE8, and now IE9. You can see a full list of features for each version on his test page.

Pros:

  • Allows developers to build for modern browsers, using modern techniques.
  • Stop wasting time back-coding/fixing/hacking for older browsers.

Cons:

  • Additional download weight, varies by version (each version adds new corrections, so they get bigger as they get better): IE7 is 32.1kb, IE8 is 36.6kb, and IE9 is 40.5kb.
  • This is a JavaScript fix, so if JavaScript is disabled, the user will not get the enhancements.
  • If you place the script at the bottom of your page, users will see an “uncorrected” page first, then the fixes will pop into place as the script runs; if you place it in the <head> of your page, you will have to wait for the script to download and run before your page can continue to load.

When is it best?

This is really good for fixing things like float issues and old IE bugs, but I find I can usually fix those fairly easily with careful HTML and CSS planning (and maybe a couple small hacks). The one-time, fix-it-all approach could be nice, but to me it is sort of like killing a fly with a nuclear bomb, in that it fixes things that might not need to be fixed (if the current page doesn’t use rounded corners, there’s no sense having the JS do that work, yet it does). I personally don’t think I would ever use this on a client site. Between the additional weight, the reliance on JS, and the additional work the browser has to do, I think this is overkill. I personally prefer some of the other methods below, but wanted to cover it here, in case your situation differs.
Back to Options

Modernizr

Next up is Modernizr, by Faruk Ates and Paul Irish.

Modernizr takes a slightly different approach. Rather than trying to fix everything that is wrong with an older browser, it runs a series of feature-detection checks against the user’s browser and adds boolean-style classes to the <html> tag to indicate whether the browser supports certain features or not, like this:
<html class=" js borderradius no-geolocation...">
Meaning, js is enabled, border-radius is supported, but geo-location is not.

With this information, you can write feature-specific CSS, such as:
.borderradius div {
/* CSS if browser
supports border-radius */
}
.no-
geolocation div {
/* CSS if browser doesn't support
geolocation */
}

Of course, you can also write feature-specific JS, determining whether or not to add a widget, for example.

You can see the full list of features that are checked, as well as see the <html> classes it attaches, on the Modernizr site.

Pros:

  • Additional weight is marginal: 5kb GZipped (27kb unzipped).
  • Runs fast, minimal intrusion on page-load.
  • Allows you to check for features, not browsers, which is far more specific.
  • Apply alternatives for modern features with pinpoint precision.

Cons:

  • This is a JavaScript fix, so if JavaScript is disabled, the user will not get the enhancements.
  • Must be at the top of the page, so does require browsers to download and run before the page can continue loading.

When is it best?

With the way new CSS3 effects are being added to browsers seemingly daily, this is a really good approach, especially if you are only using select effects. It allows you to write specific lines of CSS to affect the “haves” (.rgba article{background:rgba(255,0,0,.5);}) and other lines for the “have-nots” (.no-rgba article{background:url('background-image.png');}).
Back to Options

eCSStender

* Note: I have yet to be able to get this one working on any version of IE, but felt it is such a strong concept, it is worth adding here.

A fairly new kid on the block, from none other than Aaron Gustafson, is eCSStender (pronounced “extender”). Taking sort of a hybrid approach, somewhere between DEIE9 and Modernizr, eCSStender offers a series of eCSStensions (:-) that developers can include in their pages and fix older browsers for modern features.

For example, the CSS3-color extension adds RGB/RGBa, HSL/HSLa, and opacity support back to IE6 (obviously only for browsers that need it).

But beyond just correcting older browsers to handle newer features, developers can also write extensions that take the browsers beyond CSS3, into new features that don’t exist anywhere yet!

Pros:

  • Core JS is under 16kb, minified.
  • Modular, so users only need to download the extensions they need for each page.
  • Additional weight depends on the extensions your page/site needs.
  • Checks for feature-support and fixes what needs to be fixed (and only what needs to be fixed).

Cons:

  • Still kind of new, so the list of extensions is not very large (but the ones that are there, are powerful!).
  • Though this only fixes things that need to be fixed, users still have to download the code, and it still has to run on all browsers to determine what needs to be fixed and what doesn’t.
  • This is a JavaScript fix, so if JavaScript is disabled, the user will not get the enhancements.
  • If you place the script at the bottom of your page, users will see an “uncorrected” page first, then the fixes will pop into place as the script runs; if you place it in the <head> of your page, you will have to wait for the script to download and run before your page can continue to load.

When is it best?

When you have only specific CSS3 effects that you want to use, an extension for that effect exists, and you don’t want to figure out how else to do it with straight CSS.
Back to Options

PIE

Who doesn’t like pie? Personally, I love apple, pumpkin, and my grandmother’s pecan. But in this article, we’re talking about PIE (as in, “Progressive Internet Explorer”).

Also taking the “fix-it” path, PIE relies not on JS to do the work, but on HTC (HTML Components), which is applied via a behavior, which makes it IE-only!

You apply PIE to an element via your CSS declaration (yes, it does have to be applied to each and every CSS element that needs it), thusly:
h1{behavior: url(PIE.htc); border-radius: 10px;}
IE will interpret the HTC behavior, then it will understand the border-radius. Seriously!

The demo on their home page is pretty cool, but remember that it only works in IE.

Pros:

  • Only affects IE users.
  • Users download one HTC file, used for all elements that need to be fixed.
  • Can be used for a wide variety of CSS3 fixes.

Cons:

  • behavior does have to be in each and every CSS declaration to which it should be applied. That said, you could include all the behavior statements in an IE-only CSS file/block if you so chose.
  • Limited feature support, currently only border-radius, box-shadow, and linear-gradient (but those are big ones!).
  • A bit of a resource pig. If you have this run against too many elements on the page, it WILL kill your browser.

When is it best?

When you need only one of the above three CSS3 effects, in IE (regular CSS3 allows you to do all three of the above in all modern browsers). This is another really good precision method, applying just want you need, just where you need it, and when you need it.
Back to Options

IE-CSS3

From Keith Clarke comes this purely JS solution to CSS pseudo-selectors in IE6-8, IE-CSS3.

Include this in your page, ideally serving via IE conditional comments, and your CSS can now take advantage of such declarations as :not(), :enabled and :disabled.

Pros:

  • At only 4.41kb, no one will notice this addition.
  • Can easily target IE users only.

Cons:

  • Minimal enhancements, but it does what it says, and that’s all it says it does.
  • This is a JavaScript fix, so if JavaScript is disabled, the user will not get the enhancements.
  • If you place the script at the bottom of your page, users will see an “uncorrected” page first, then the fixes will pop into place as the script runs; if you place it in the <head> of your page, you will have to wait for the script to download and run before your page can continue to load.

When is it best?

When you only need to add the pseudo-selectors it covers. Again, no advanced decoration enhancements, just selectors.
Back to Options

jQuery plug-ins

Not to be overlooked, there are a host of jQuery plug-ins that assist with bits and pieces here and there. Hunt for what you need, and use just what you need.
Pros:

  • Look for just the enhancements you need.
  • Can easily target IE users only.

Cons:

  • All are still a JavaScript fix, so if JavaScript is disabled, the user will not get the enhancements.
  • If you place the script at the bottom of your page, users will see an “uncorrected” page first, then the fixes will pop into place as the script runs; if you place it in the <head> of your page, you will have to wait for the script to download and run before your page can continue to load.

When is it best?

When you just need a piece of help, the right plug-in might be just what you need.
Back to Options

So, what really IS the best?

What would really be best, I think, would be something that ran in all browsers, detected which CSS effects were not supported, fixing those that need to be fixed, and translating all vendor-specific declarations into standard ones, so that I could just write:

border-radius:5px;
instead of having to write:
border-radius:5px;
-moz-border-radius:5px;
-webkit-border-radius:5px;
-o-border-radius:5px;
-ms-border-radius:5px;
_background-image:url(...);

What would be great about this, is that, ideally, it would eventually become moot, as all browsers eventually adopt standard CSS. Now that would be best…

Happy CSS3ing,
Atg

Solving the Problem with Background-Images and Print CSS

A client recently brought to my attention an issue that I always said I was going to look into more closely, but somehow just never really got around to it: print CSS.

We all know we should be doing it, but how many of us really go through our projects, page-by-page, clicking Print Preview?  Well, I know I hadn’t really done much at all.

And so it is no wonder I had not come across the issue with background images before.

I think most browsers have Print Background unchecked by default, which means probably an enormous percentage of users never see our background colors or images.  Getting around light-colored text that should appear in front of a background color is easy, but what about background images?  You know, like graphic headers and such…

The obvious solution was to exchange the background images for good-old <img> tags, but that would mean breaking apart all those sprites I worked so hard on, and losing all the benefits of using sprites, right?

Turns out, no.  Here’s what I did…

Previously, I had something like this:
<h1><a href="...">This is my header</a></h1>
h1 {
width: 100px;
height: 30px;
background-image: url('mysprite.png') 10px -100px no-repeat;
}
h1 a{
width: 100px;
height: 30px;
display: block;
text-indent: -9999px;
}

Right? The <h1> has the background image, positioned, and the text inside the <a> is pushed off screen, so it doesn’t interfere with the background image.

Now, I have this:
<h1><a href="..."><img src="mysprite.png" alt="This is my header" /></a></h1>
h1 {
width: 100px;
height: 30px;
}
h1 a{
width: 100px;
height: 30px;
display: block;
overflow: hidden;
}
h1 img {
margin: -100px 0 0 10px;
}

By placing the image inline, the print CSS will see it and print it.  But I can still use my sprited image as the src of the <img> tag: by using the margin, in conjunction with the overflow: hidden, I can move my image around inside the <a>, as if it were still a background-positioned image.  And, I still get all the benefits of using sprites, because once the sprite is used for one <img>, it is cached and will not be fetched again for the next <img>

And of course, where I previously had inline text for accessibility and SEO reasons, but positioned off-screen for readability, I now have alt text, so no loss there either!

Just thought I’d share, happy CSSing,
Atg

How to Get Started with HTML5 and CSS3 (Twice…)

Amazingly, within days of each other, two HTML5/CSS3 starter kits come screaming down the Information Superhighway:

  1. First from Monkey Do! comes HTML5 Reset, with such hits as:
    • HTML5 document structure
    • About half a dozen IE-specific CSS files
    • Popular IE-correcting Javascript files
    • Comes in both a “Bare Bones” version (stripped down to the essentials) and a “Kitchen Sink” version (when we want the option to remove features)
    • And more!
  2. And from Paul Irish and Divya Manian comes HTML5 Boilerplate, offering such greatness as:
    • Cross-browser compatible (you would expect less?)
    • HTML5 ready (or at least as close as you can get)
    • “no-js” / “js” classes added
    • Mobile browser optimizations
    • And other great bonuses, read the entire list!

Both look interesting, though I personally haven’t done a flat HTML site in some time, would be nice to see at least one of these converted into a WordPress theme.

Hmm… sounds like a good summer project…  :-)

Happy HTML5ing,
Atg

Today’s Readings

A few really nice HTML5 and CSS3 resources came out recently.  Check them out!

  • 25 HTML5 Features, Tips, and Techniques you Must Know
    A good list, whether you’re experienced or new to HTML5.
  • HTML5 Reset
    A starting point for all your new HTML5 projects, including HTML template and CSS reset.
  • CSS3 Playground
    Not completely unlike other variations, but does a really good job of letting you easily play with several CSS3 items.  Have to say, though, not all that practical, since it only offers the CSS for the browser you’re currently using… (WestCiv at least allows you to switch between Mozilla or WebKit, but CSS3Please just gives them all to you, one fell-swoop.)
  • An introduction to the Canvas 2D API
    I’m not totally sold on the practicality of <canvas> yet, but it can’t hurt to at least keep up a little…

Happy HTML5ing and CSS3ing,
Atg