Training the Trainer (T*t) in Tucson

Molly and Christopher

It’s not every day a well-known, highly regarded Web professional gives away their hard-earned knowledge and precious time for free. Nonetheless, that’s what my good friend, Molly E. Holzschlag, is doing in her Train the Trainer (T*t) workshop series.

For almost every weekend starting in mid-September and ending in October, Molly is hosting six educators for the free two-day workshop in Tucson, Arizona.

If you happen to get one of the 24 golden tickets to her workshop, you’re a lucky one as the workshop itinerary is impressive:

  • Day One
    • HTML & XHTML intensive. Principles, best practices, issues of concern
    • Lunch discussion: Open discussion of issues and concerns to group
    • CSS Theory Part I
  • Day Two
    • CSS Theory Part II, contemporary design considerations
    • Lunch discussion: Open discussion of issues and concerns to group
    • Standards workflow, SEO, basic Accessibility, intro to Microformats
    • Dinner and drinks at a local Sonoran Mexican restaurant including vegan & vegetarian as well as a wide range of other options

On the last T*t workshop that takes place October 27–28, I’m flattered to aid Molly in presenting my talk on IE7 and CSS, “Releasing CSS: How I Learned to Stop Worrying and Love IE7”.

Also, I’m looking forward to the lunch discussions where I hope I won’t make the participants poorer by giving them my two cents regarding any Web design or development questions or concerns they might have.

For more information, check out Molly’s post about Training the Trainer.

Hope to see you there!

Free Copy of Releasing CSS

Releasing CSS: How I Learned to Stop Worrying and Love IE7 covers designing with CSS for Microsoft’s latest and greatest: Internet Explorer 7. 

Releasing CSS

The fine publisher, O’Reilly, wants to distribute a few free copies to those who would post a review on your blog. So, if you would like a free copy and wouldn’t mind writing a Summer book report, comment on this post making sure to include your blog’s Web address. 

Many may enter, a few will get ’em. So, post a comment and good luck!

Flux, Part 3: The Plugins and Touchups

Work continued on Flux, my new site design, this past week. There were two main issues I wanted to resolve: extending WordPress and applying some design fixes to common HTML elements like unordered lists. 

WordPress Plugins

Three new plugins are now installed:

  1. Code Auto Escape. WordPress has a nasty habit of not rendering code correctly. Sure, you can try to use HTML entities, but that’s only a bandaid. WordPress gladly converts the HTML entity into the display character. 

    However, if you make revisions to the post, WordPress does not revert back to the HTML entity. This feature is only slightly annoying as I like to, you know, post about Web standards technologies. 

    Thankfully there is the Code Auto Escape plugin. This is a simply awesome plugin from Priyadi Iman Nurcahyo. Using HTML elements like code and pre, WordPress handles the formatting of coding with making a mess of my post. 

    After I installed the plugin, I spent a good while getting this (outdated) post displaying code properly. That felt really good. 

  2. Google Sitemaps. An XML-based sitemap allows Google’s crawlers know of pages within your site that might be new or generated by dynamic content. Odds are Google’s spiders are already aware of your site’s pages, but feeding your own sitemap is a nice added bonus to make sure everything is covered. 

    Arne Brachhold created the Google Sitemap Generator that makes all that messy XML for you — automatically–everytime you add a post or page through WordPress. Set it and forget it.

  3. Subscribe to Comments. Ever post a comment and wish you could be notified when the discussion continues? That’s the way I feel when debating whether Starbuck is the the last of the Final Five (she’s not), whether the Doctor is the last of the Time Lords (he’s not) or whether Snape is friend or a foe (he’s neither). 

    The Subscribe to Comments plug-in does that. There’s even an option to allow readers to subscribe to a post without commenting themselves. However, I feel this isn’t very fair. If you want keep up with the conversation, at the very least, I ask that you throw in your two cents for the privilege.

If anyone has any WordPress plugin recommendations, please let me know via the comments. 

Design Touchups

Some miscellaneous design touchups that happened on the site:

  • Bullet Icons. I have nine bullet icons ready to go for nesting unodered lists.

    I’m not saying I’m going to present you, dear reader, with an unordered list that’s nested nine times. I’m just saying I’m prepared. You can see the first three bullet icons on this post where the lists only go down three levels.

  • Ordered Lists. Nothing too fancy, but I turned the numbering back on as Yahoo!‘s Reset CSS got rid of them altogether. It’s amazing finding what you took for granted after it’s gone.

That’s about it for the design update this week. 

Color Shades

During my brief talk at SXSW Interactive, I mentioned that you could use color shades. Color shades are small PNG images filled with a black or white color set to a certain opacity which can be used for tinting background colors or images. 

In this example, a color shade is placed in the background image of a heading that rests on top of a photo. 

Color Shade Demo

For another example, check out the CSS Cookbook site. There I use color shades to retain the gradient within the unordered lists that are placed in background of the design. 

If I used the traditional slice-and-dice/Image Ready method for production, I would need to have different background image for each list item. With color shades, I simply use two images: one color shade and the background image. 

A benefit of color shades is allowing site visitors to resize their fonts while maintaining the cohesive site design. 

Another benefit is the as ease of site maintenance. I can easily throw in an extra list item if I need to without breaking a sweat or opening Photoshop.

Downloads

To save you time, I’ve created a set of color shades (~171 KB) that are free for downloading and use. I’ve included shades of both white and black with stops at every 10 percentage points. Also included are color shades set 33 and 66 percentages as well as the original Photoshop source file.

Note: you will still need to use a method for supporting PNGs in IE6, if you still want to support that browser.

SXSW07: Unleashing CSS


How I Learned To Stop Worrying And Love IE7
Originally uploaded by chasingfun.

It’s only the first day of SXSW Interactive 2007 and you can tell how popular this event has become over the last few years. Thankfully, I had the pleasure of talking earlier today regarding CSS and IE 7 to a sizable portion of the largest SXSW Interactive conference I’ve every seen. 

The slides from the talk, “Unleashing CSS: How I Learned to Stop Worrying and Love IE7″, are available as a PDF (~2MB).

In my talk, which was shortened for time, I glossed over the finer details of IE7 and some CSS tricks. If you would like to know more about the talk, please take a look at my ebook, Releasing CSS, available from O’Reilly. In the ebook I go through some of the main points I made in my talk as well as cover the basics of the new things one can do in IE7.

CSS Cookbook, Second Edition

CSS CookbookIn late 2006, my new book, the second edition of CSS Cookbook, came out by O’Reilly. While the CSS Cookbook provides hundreds of practical examples with CSS code recipes that you can use immediately to format your web pages, I’d like to point out some of the other positives from this updated edition:

  1. Expanded. Coming in at 538 pages, the second edition is almost twice as large as the first edition.
  2. Revised and Updated. The book didn’t just add more pages to the previous edition. Not one chapter went untouched in the second edition. While we added more to the book, some recipes were thrown away if it was deemed out of date (like the hybrid, HTML table layout).
  3. New Chapters. Also included are two new chapters: one chapter geared for general CSS knowledge to help the beginners and another chapter for techniques centered on images.
  4. Bears. On the cover is the Grizzly Bear. TV star Stephen Colbert states that the Grizzly Bear is one of those “godless killing machines without a soul”. Sounds like all the backup you need to squash bugs, the web development kind and any cockroaches your girlfriend finds in the bathroom.
  5. Form Elements. Web forms makes the ecommerce world go ‘round. So knowing how a form element will or won’t be affected by CSS properties becomes paramount to any Web designer. That’s why I included in the second edition an appendix dedicated to detailing how form elements were affected by CSS properties.

    Screenshots showing how 20 CSS properties on eight form elements (checkboxes, file upload elements, radio buttons, text fields, multiple options, select elements, submit buttons, and text areas) were affected by in ten modern browsers (Windows Internet Explorer 5, 5.5, 6, and 7; Mac Safari 2; Windows and Mac Firefox 1.5; Windows and Mac Netscape Navigator 7.2; and Opera 8.5).

    In all over 1,600 screen captures were taken to get this job done.due to printing costs, the entire 160 page appendix had to be reduced to make room for other parts of the book, …like chapters one through ten. 

    Thanks to the phenom known as the World Wide Web, such physical limitations are mere annoyances. Therefore O’Reilly has graciously allowed the unedited 160 page version to be downloaded from their web site.

  6. Code Download. With a book that goes through code samples like they were going out of style, the new edition organizes the code in a much more orderly fashion. Now you can find the code sample as easily as you an find the recipe in the book.
  7. Thud. It seems like there are dozens of books coming out every month all geared at helping Web designers and developers make a better Web experience. That’s why I was floored when the editors at The Designers Bookshelf honored the CSS Cookbook, Second edition, as The Web Design Book of the Year.

Building Design Bricks

A common style of designers starting out is to build with what I call “design bricks”. A design brick is a Web page design that is a only an image or set of images exported from Photoshop, Illustrator or any digital imaging software.

You can see an example of a design brick at the web site for Cellar Grille. From what I’ve been told by my friend, they have some great food.

Also, I know just by not even going to the place myself (which is about two hours from where I live), that their menu is looks good, too. How do I know that? Well, their designer exported both sides of the menu from their design program and placed both sides as one image each on one web page.

There are several reasons not to design bricks, but I’m only going to touch on a few. (If you are familiar with building sites with CSS, you know these reasons since they are pretty much the same ones.)

For starters, spitting out large images as Web pages is not designing to the medium’s strength. The Web is an imperfect place to design. Where rigid control over the design found in print design is the understood norm, the Web is the wild west. Users have final say in how they view your content and the design that forms that content. 

Fonts can grow to be large to help visitors with poor eyesight read your blog. Images might be turned off since they take to long to download. And people might not even want to install Flash because, well, in the wrong hands Flash can be poorly done.

How can you design for this frontier? You can shore up your fonts and presentation through a system that’s come to be called “bulletproofing”. For more information, check out Dan Cederholm’s book called Bulletproof Web Design.

Another reason is maintenance. When you are in charge of several web sites, being able to update the content needs to be a painless process.

I’ve had design students who will promise me that exporting a large design brick is easier than editing a text file. I don’t believe them since some HTML editing software I use has FTP capabilities built right in. In theory, I could open the file directly from the server, edit the content and hit save before the end of television commercial break or before Photoshop has finished loading its menus.

The third reason is copy and paste. I’m reliant on the web for making my life easier. If I need to tell someone about a great product, service or company, I want to be able to shoot over the link in an email, but I also send a snippet from the site’s content to entice my friend to check out the site. 

More importantly, there are going to be times when I want to place contact information into my address book. Copy and paste makes that a mindless exercise. If that contact information is trapped into a large image, how long is it going to take me to copy that text into my address book?

The quicker you allow your content to be distributed, the farther your site’s reach will be. Getting a web site design together and putting it on the web is just the start. Making sure people can make efficient use of that content is one more step you can make.

The last reason I’ll touch on is search engine optimization (SEO). By having your content in an image, a search engine like Google won’t be able to know what’s in your site. If it doesn’t know your content, it won’t know how to place it correctly in the search engine rankings. The way to circumvent that is to have the Best Web Site Ever to make sure people all over the world are talking about your design brick. But that’s going to cost money and the last I checked, a 30 second spot for a Superbowl ad is a bit over two million dollars.

So, when you are designing for the web there are challenges, but don’t try to circumvent them by making a web design one large image. Face the wilderness of the web head on. It may feel like you are hitting a brick wall the first few or several times, but you will get the hang of it punching through in no time and become a better designer for it.

WebVisions 2006

Last week I had the privilege of speaking at WebVisions in Portland. It was my first time at WebVisions and Oregon as well. What impressed me with the conference was the breadth of expertise that was present for such an intimate two-day conference nestled in the beautiful landscape.

As requested, you can download the slides from presentation. These aren’t the exact same slides I showed. I revised them slightly during one of my worst flights on Delta. 

For those who don’t know, I’m 6′7″. I didn’t get an exit row on a midnight flight back home and the dude in front of me reclined his seats into my knees for the next four hours. Instead of seething hatred at a fellow man, I attempted to put that energy into somewhat practical use. Thank goodness for laptops.

While I wasn’t happy about the trip back, I am happy to report that one of my predications from my talk came true. Less than a week after my presentation the announcement came out: Microsoft to Push IE 7 via Automatic Updates.

Does this mean you need to drop everything you are doing and test your web site right now? Honestly, I wouldn’t. For a couple of reasons. One is that even with the next version coming soon, we are still talking about unreleased software. The other reason? Well, if you were in my presentation, you’d know.

After my presentations, I always like it when people come up and talk to me. Not because I usually remember to brush my teeth, but because I like to help people solve web problems if I can. This recent time, however, I felt bad that I couldn’t solve one particular person’s problem on the spot. 

On the very long flight back, I gave some more thought to the problem and quickly whipped up a solution to How to Keep Content within a Second Column Vertically Center in Relation to the First Column. As proof that I’m not quick on my feet, the solution is an easy one: shackling.

What’s Shackling? It’s a term I use for absolute positioning a block level element within the context of relative positioned parent element. And let’s face it, that’s a mouthful. 

To check out the fix, see the solution. Of the two readers I have on my blog, I hope the person that asked about the problem is one of them.

For those that stayed towards the end of the talk, I put on display a little demo that wasn’t IE7 compatible, but I think is cool nonetheless. Combining pseudo-classes :hover on block level elements and :target, it’s a page that was put together so I could test some of IE7’s capabilities. When the test was created, I was excited by the over hype of IE7 that I actually thought it would handle CSS3 selector. Sadly, IE7 fails :target, but the presentation degrades gracefully so the CSS can be applied without having to worry about IE wonkiness. Try it in Firefox or Safari and then in IE for fun and profit.

Lastly, I want to give my thanks to Brad, the whole crew at Hot Pepper Studios and Nick for putting on a good conference. It’s one of the best.

My PNG Image Replacement Method

Recently, I had to tackle a project that required the use of alpha transparency in PNGs. It’s been a while since I needed to work with PNGs—resorting to using GIF’s one-color transparency for several years as a suitable workaround. I never gave PNGs much thought for several years since the developers for Internet Explorer always seemed fail to support it for numerous years.

So I thought this being the new millennium, I’d re-examine what my options were. With a brash sense of naivety, I assumed browser vendors had this problem solved. Why shouldn’t I? Just look at the browsers that support PNGs natively: 

  • It’s been six years since Internet Explorer for Macintosh came out with native support for alpha transparency. 
  • Netscape Navigator now supports PNG. 
  • Even Opera has been supporting PNG for a while. 
  • From the Preview and Beta Releases of Internet Explorer 7, Microsoft looks to release a browser for the PC with native support for PNGs with alpha transparency. Finally.

PNGs, Natively

What do I mean by natively? I mean that by using the ubiquitous img tag (see example), the browser would render a PNG image just as normally as any GIF or JPEG a web developer might use, except that PNGs can come with stupendous alpha transparency:


<img src="alpha.png" alt="Image with alpha transparency" />

While we are waiting for IE7 to launch, everything is still not perfect. Internet Explorer 6 for Windows still doesn’t support PNGs natively. As I wrote earlier, when IE7 does launch, web developers will still have to support IE6 for about a year after the new browser. 

So a solution is needed to provide PNGs natively to the browsers that support them and a workaround solution to the browsers (Internet Explorer 5.5 through 6 for Windows*).

Pre-existing Solutions

And there have been solutions developed to work around the IE5.5–6’s inability to handle PNGs natively. Although, I’m sure there are more, here are a couple: 

I’m sure there are more. If there’s a solution that’s not here and you think it should be, please leave me a message in the comments section. 

Note: These solutions work on Internet Explorer 5.5 and higher because version 5.5 is when the properitary CSS filter property was introduced.

How These Solutions Work

While they are many solutions, there is really just one way these solutions work. In a rudimentary way, here’s how they work:

  1. When you code the page, be sure to set the width and height of the PNG image in the CSS with the width and height property.
  2. As a page is loaded, a piece of JavaScript is executed. 
  3. The script goes through the HTML markup looking for img elements that point to images with the png extension.
  4. Once it finds such an img code, the script dynamically rewrites the HTML on the fly…
  5. The first part of the revision is to replace the PNG image with a single pixel GIF that is transparent.
  6. Next, the PNG file is set in Internet Explorer’s filter property in order to trigger the alpha transparency in that browser. Since the only way this can be done, the PNG gets set in the background. Thus, the need to set the width and height for the image.
  7. Thus, the PNG is shown in the background behind the transparent GIF.

It’s a bit of clever thinking and a nice bit of coding to compliment it.

The Problem with the Solutions 

Even though the solution works, I couldn’t help but think that the solution is based on JavaScript, which users can easily switch off in their browsers. I know in these Web 2.0 times that JavaScript is an expected minimum requirement for people to use AJAX enabled sites. I don’t want to ruin the AJAX crowd’s party, but isn’t there another solution? What if a developer simply wants to use a PNG image—only one PNG image—and making sure a site isn’t dependant on JavaScript? What we need to do is have a way to use PNGs without mandating that site visitors have JavaScript enabled. 

Besides, isn’t using a transparent single pixel GIF really too Web 1.0?

Alpha PNGs Mean Bloating 

Another item to consider is file size. If you look at the filesizes that PNGs with alpha transparency usually have, you will notice that they are usually larger. A PNG image with alpha transparency by its nature to retain the color information about alpha transparency will be a larger file size (see Table on File Size Comparions). Because of this large file size, more times you will find that to limit your use of alpha transparent PNGS. 

File Size Compation for Images

File Type

File Size

Demo

PNG 24-bit

166kb

cssckbk_cover.png

PNG 8‑bit

64kb

cssckbk_cover_8bit.png

JPG

52kb

cssckbk_cover.jpg

GIF

76kb

cssckbk_cover.gif

So, if you find yourself using a multiple 24-bit PNGs, chances are your web page file size is very bloated. If you find yourself using mulitple PNG images, I would ask:

  • Are you sure you need to use all those PNGs?
  • Are your users on fast enough connections to not mind the bloated file size? 

If the answer is “yes” to both those questions, then a JavaScript solution for the PNG dilemma is probably the best solution for you. 

For other situations, we need to think of another solution. 

We need a solution in the same way as we do with the many image replacement methods that are available. In fact, that’s how my proposed solution works—by piggybacking off an image replacement technique and by delivering the appropriate CSS rules we can work around this problem. 

Schmitt PNG Image Replacement Technique

The first part of the solution is to lay the foundation with HTML: 


<h1> 
 <a href="http://www.christopherschmitt.com/">
  <span>Hello, world!</span>
 </a>
</h1>

The next step is to use an image replacement technique to slide the PNG you want to use:


h1 a {
 display: block;
 width: 400px;
 height: 100px;
 background: url(”hello_world.png”) no-repeat 0 0;
 text-indent: -1000em;
}

I saved this CSS rule along with my other styles in schmitt-png-ir.css.

Now, if you stopped here, your web page would render fine in all browsers except Internet Explorer 5 through 6 for Windows. 

Filter Style Sheet 

In order to accommodate those Internet Explorer 5.5−6 for Windows, we need to set up a separate CSS rule that calls Microsoft’s proprietary filter property in order to activate the alpha transparency:


h1 a {
 text-indent: -1000em;
 background-image: none;
 filter: progid:DXImageTransform.Microsoft.
  AlphaImageLoader(src='hello_world.png'),
  sizingMethod='scale');
}

I saved this style sheet as filter.css.

What About 5?

The problem with this solution is that Internet Explorer 5 for Windows neither handles PNGs navitely nor recognizes the filter property. The workaround is to supply that browser with a specialized GIF image that resembles the PNG image’s alpha transparency. 

Since PNGs have 256 shades of transparency and GIFs only have one color that can be assigned as transparency, it’s a little bit of a stretch to mimic alpha transparency. Yet, it is possible. In Photoshop, select File > Save for Web. Then in the select to export the image to GIF. Then select Diffusion Transparency Dither as shown in the screen capture. 

Screen capture of Diffusion Transparncy option

Sure, it’s a bit of a hack, but your visitors will get the idea. And it’s less annoying, in my opinion, than keeping the content from the visitor than showing a browser upgrade message. 

So with the new image, we need to set up a separate style sheet that will deliver the image to Internet Explorer 5 for Windows: 


h1 a {
text-indent: 0;
background-image: url(”hello_world.gif”) !important;
}

I saved this file as winie5.css.

Associating Styles to the Web Page 

Setting up the style sheets is only part of the solution. The other part is just as important: how to associate the files to the web page. 

First, link to a style sheet file that to blank file: 

This screen.css file is basically a launching pad to other style sheets. In this style sheet, I import three important style sheets:


/* master, standards compliant css */
@import url(”schmitt-png-ir.css”);
/* styles for winie5.0 - .gif */
@media tty {
 i{content:””;/*” “*/}}; @import ‘winie5.css’; {;}/*”;}
}/* */
/* styles for winie5.5 - .png */
@media tty {
 i{content:””;/*” “*/}}@m; @import ‘filter.css’; /*”;}
}/* */

The @import rule simply loads the base style sheet which includes the standards-compliant method for calling up the PNG image as a background image. 

The first @media rule is a hack that lets only Internet Explorer for Windows 5 import the winie5.css file. Developed by Tantek, the IE5/Windows Band Pass Filter works like a charm.

The second @media rule is another, similar hack called IE5.5/Windows Band Pass Filter. This time only Internet Explorer for Windows 5.5 imports the filter.css file which triggers the Microsoft filter property. 

You can go through the code for the final screen.css here.

What About Internet Explorer 6?

Unfortunately, there isn’t a unique High Band Pass Filter just for Internet Explorer for 6. The solution to deliver the appropriate style sheet to that browser is to use conditional comments. Conditional comments is another Microsoft proprietary extension to browsers. It allows developers to target specific Internet Explorer browsers to render HTML code while other browser will ignore the code. 

To use the conditional comments, I go back to where the link tag used to associate the screen.css file tothe web page. Below that HTML code, I use the conditional comments to let only Internet Explorer 6 for Windows pick up the filter.css.


<link rel="stylesheet" type="text/css" href="screen.css" />
<!–[if IE 6]></strong>
<link rel="stylesheet" type="text/css"  href="filter.css" />
<!–[endif]–> 

With that, all modern browsers that can handle a alpha transparency in PNG images will get the PNG image or get a GIF image instead.

The Proof

Does the solution work? Test out the example page on your own with various browsers or take a look for yourself at these screenshots: 

Benefits

Here’s a listing of the benefits in this solution: 

  • Does not require JavaScript in order to work
  • An extension of image replacement techniques, easy to implement and understand 
  • Works in versions of IE that don’t handle PNGs natively (Internet Explorer for Windows 5–6)
  • Works with any PNG capable browser’
  • Does not require a transparent, single pixel GIF 

Cons

Note that the first three items in this list are disadvantages based on Microsoft’s filter property and not the solution itself. 

  • Does not work on inline PNG images
  • Works only on background images
  • PNG images won’t tile
  • Doesn’t work in Internet Explorer 7 Beta 2

What about Internet Explorer 7 for Windows? 

As mentioned earlier, Internet Explorer 7 for Windows handles PNGs natively and therefore can handle the standards based rule without needing to use the CSS “filter” rule. Since there’s no need for WinIE7 to use the filter rule, there’s no need to pass it on. 

However, based on testing for this solution, Internet Explorer 7 Beta 2 for Windows appeared not to accept the PNG IR technique. If someone wants to test the set up and make modifications to the technique, please do and let me know about it. Until it Internet Explorer 7 for Windows launches, I’m not going to bother unless I have a free moment or two to try some things out. 

My overall attitude to browser software in beta has been soured since the Netscape Navigator 3 and 4 betas. As a result. I don’t actively test web sites on browser betas no matter how many times these browser developers tell us their code is “layout complete“. If it’s beta, it means it’s not complete and will always, always have changes until it comes out.

How Long Will We Need a PNG Workaround?

In my article about the adoption rate of Internet Explorer 7, I made the assumption that Internet Explorer for Windows 6 will be around for a while. Based off the launch and staying power of Internet Explorer 5 for Windows, I’m expecting the workarounds for PNGs will have to last for a year after the launch of IE7. 

In Conclusion

Instead of a solution that acts like a hammer in replacing every instance of a PNG, we need a solution that acts like a small screwdriver. By isolating one or a few images that can be PNGs, we have a solution that works best for sites that do not need or want to be dependent on JavaScript.