Archive for September, 2007

Easier Image Replacement

Monday, September 24th, 2007

If you didn’t hear, text on a website is better than an image. Images have their place, but many people use images where text should be. In recent times, people have been using a technique called image replacement to replace text with an image. Typically, there are crazy hacks that involve embedded elements, but there is an easier way.

Before I get to that, I want to clear up when I think it is good to use images and when it is good to use image replacement.

It’s good to use image replacement when the object in question is, simply, an image. For whatever reason, I always picture a horse, silhouetted against a brilliant pink sunset, running through a grassy field on cliffs above the ocean. What I did there was describe the image, which goes in an alt attribute. My rule for using images is: if the proper description is a sentence (or longer), use an image with an alt. If the proper description ends up being a few words (e.g. Amazon Logo), use image replacement with semantic markup.

Most of the time, fancy heading text (in h1s, etc) and logos are prime targets for image replacement. Logos typically appear at the top of the screen and, to me, seem to be the top-level heading of the site. Other times, people want their heading text to be in fonts that aren’t web safe. This is a great time for image replacement, because it retains the semantic value and accessibility without some level of complication (that is, the heading isn’t the alternate text inside an image, it’s just the text).

There are tons of ways to do image replacement. Until recently, I was doing it the way I think most people do it (sorry for the inline CSS; I’m trying to avoid confusion):

1
2
3
<h1 style="background-image:url(myheading.png); width:100px; height:100px">
 <span style="position:absolute; margin-left:-9999px;">My Heading</span>
</h1>

This is a perfectly valid way to do the markup. The only problem is that it has that extra span in there. It’s semantically valid (since spans don’t mean anything, but it’s one more level of complexity (that is, the heading is the text inside of the span), which is what we wanted to avoid.

Instead, I’ve been doing it this way1 (again, sorry for the inline CSS):

1
<h1 style="position:relative; width:100px; height:100px; clip:auto; overflow:hidden; line-height:210px; font-size:10px; background-image:url(myheading.png);">My Heading</h1>

The relative positioning makes it possible to clip and hide the overflow of the element. So, we set our height and width to that of the image that will replace the text. We then come up with a sane image height (I’ve used 10px because the text doesn’t have to resize since it is hidden and because the default don’t display text smaller than setting in browsers should be lower than this by default (if there is any worry, we can use a larger font size). Then, we set the line-height to the site of the image plus the size of the font (this seems to hide the font just out over the height of the element). Using the line height, we can also assure that the text will be hidden since it will be below the visible area instead of to the left or above it.

There you have it: yet another way to do image replacement. Is it better? Maybe. It reduces the complexity of the markup, making it less bloated and a bit more efficient, semantically if nothing else. However, it increases the work that needs to be done on the CSS side. With this we have a little math to do, and a little bit more to type. To reduce the extra typing a class could be created to handle the position, clip, overflow, and font-size with the second class setting up the stuff that changes per image. In the end, do what suits you best. I’ll be doing it this way.

As a warning, the only problem I’ve run into2 was if I set the line height too high, Internet Explorer would have some rendering problems. I don’t remember exactly what happened, as it’s been awhile since I tested this on a real browser. I’ll be sure to update this post the next time I am able to test.

  1. Wait! This is sort of untrue. I thought I was doing this one way, but it turns out I was wrong. I was using something with position: absolute, which has some positioning problems if the user is unaware of how absolute positioning works. I’m pretending I’ve been doing it this way because I like it better.

  2. Technically, it was a problem with the way I was doing the absolute positioned way. I’m leaving the warning in just in case for now.

Who the Hell is Domain Design Shop?

Friday, September 21st, 2007

I ordered a couple domains from GoDaddy a few days ago. I wasn’t really surprised when I found an e-mail with the subject Important information about your domain. I was surprised at what was inside.

Hello,
Congratulations on registering the domain: [removed for privacy]. Now is the time to establish an effective Internet presence. Domain Design Shop is an internationally recognized Web design company that specializes in marketing and branding. Our staff has assisted hundreds of companies, organizations, and individuals in achieving their goals of developing custom web sites and technology solutions.

Please click here to see our portfolio: http://www.domaindesignshop.com

Warm Regards,
DomainDesignShop.com [email: domain@domaindesignshop.com]

I’m not sure if these people are spamming me from my domain record or if they are in cahoots with GoDaddy. I’m guessing the former. I really need to set up a domains e-mail account.

So, here is this design company that spams new domain buyers in hopes that they will hire them. That is a really bad way to convince people of your services. But what the hell? I’ll take a look at their site.

I am greeted with a punch in the retina by an alarmingly green monstrosity. As usual, I look down at the bottom left of my browser at SafariTidy’s output. 6 warnings on their home page. I click to open the report. Each warning is about depreciated or proprietary attributes. The code is tag soup, and table based. None of the images have alt attributes. So far, these guys are spamming me, and showing me that the product they would provide me is complete shit.

Then I noticed that the color of the background image didn’t exactly match the background color of the document. The header image’s background color does match. So, there are all kinds of slightly different colored blocks floating around. It’s this sort of lack of attention to detail that separates the mediocre from the great. They also have a weird gray drop shadow-esque thing that I can’t figure out.

The thing that shines on their site is their logo work. I wish they would have included some one-color proofs, though. Other than that, their work isn’t particularly appealing to me. It is average, overall.

And, finally, the ISO Best Web Design 2006 badge on their site is… well, tacky. They don’t even provide a link to a press release. For all I know, it’s a stock graphic. I’ve never seen any other ISO Best Web Design badges. Since it dates the site to 2006, I’m sorry to say that the work done is not up to snuff for real professional designers. The lack of standards, offensive color scheme, and lack of attention to detail all point in the direction of Don’t Hire Me (ignoring the fact that they spammed me). In fact, they ought to be hiring me (or someone like me) to catch them up to 2005.

A Good Design Doesn’t Just Look Pretty

Thursday, September 20th, 2007

A successful design doesn’t just look pretty. It communicates.

Recently at work, I had to review several websites to determine what category the business falls under. I found only one that clearly stated what the business did. All the others were written under the assumption that the reader knew what the business did. Since I had no idea, this was rather irritating. I came to the conclusion that one of the ugliest sites on my list was the most well designed.

Websites exist to communicate. A website that doesn’t communicate is poorly designed. So, a note to designers, make sure your copy clearly states what the business does on the home page (or something akin to an about us page) so that people that aren’t familiar with the company know what the company does without having to figure it out. Otherwise, people might do what I wanted to: close the site after 10 seconds of not seeing a clear description.

iPod Touch Pushing the Mobile Web

Friday, September 14th, 2007

As most know, Apple released a new line up of iPods, and possibly a major improvement for the mobile web.

The iPod Touch is essentially the iPhone without the cellular radios. It has the same WiFi, runs the same operating system, and has many of the same programs. Most important is Safari Mobile.

A major stumbling block to the mobile web is the crappy and disparate browsers. Most don’t do very well with HTML, or, worse, only work with WAP. Programs like Opera Mini and the S60 Browser from Nokia have made great inroads for the mobile web. The release of the iPhone improve user interaction with the web in the mobile space.

Now the iPod touch will bring Safari Mobile to a more ubiquitous space. In a comment on The good, the bad, and the ugly – iPhone edition, I claimed that Safari would never be another Internet Explorer. I stand firm on that, as Safari Mobile is still niche, but it stands to be a much bigger play (and possibly nuisance if these iPhone-only sites perpetuate).

Whatever the case, the mobile web has no become more ubiquitous. I know for certain that I’d pull out my iPod Touch (if I had one) to browse the web with long before I’d reach for my mobile phone. The only drawback is the lack of a cellular radio. If Apple could work out some 3G radio for the iPod Touch to deliver data only and provide it with a very cheap contract, the mobile web landscape would change drastically.