Simply Put the agency blog

Posts Tagged ‘tutorial’

Make your website printer-friendly

February 14th, 2008 by Verne

The accessibility of your website is an important consideration to make. It could be as simple as determining what screen resolution your website is compatible with. The ongoing cross-browser compatibility struggle can also be seen as an accessibility issue, as can the extent that your website complies with screen reader standards for the blind. Essentially, the accessibility of your website is measured by the number of methods, mediums, and audiences that your site’s content can be easily transferred to.

icon-printer.jpgAccessibility also includes, among many other things, the extent to which your site is printer-friendly. In other words, the ability for your audience to print your content and take it with them so that they may have access to it while away from the computer. As with all aspects of accessibility, making your site printer-friendly is ideal, but not manditory. Sometimes it’s just not necessary - like an artist’s online portfolio. Other times, like with real estate listings on an agent’s website, it just makes sense.

When we were working on the recently-launched MichelleLuDo.com website, we thought about the nature of the audience that Michelle, a friendly and driven real estate sales agent, would be interacting with through her new website. What we discovered was that her clients were more traditional individuals and were likely to prefer print over web when it came to digesting information. Moreover, when you consider the steps an individual on a real estate agent’s website intuitively takes - browse a listing, find something interesting, copy the information down, visit the location - ensuring the website’s content was printer-friendly became a priority.

How to make a website printer-friendly

Making a website printer-friendly is actually quite simple. All it takes is two stylesheets - one to tell the browser how to display your website on the screen, and one to tell the printer how to print it out. You define which is which using the media attribute in the <link> tag that resides in your <head>. For example, here’s how MichelleLuDo.com’s stylesheet links generally look:

<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
<link rel=”stylesheet” href=”style-print.css” type=”text/css” media=”print” />

As you can see, we loaded 2 stylesheets and defined one as media="screen" and the other as media="print".

Once you’ve got the two stylesheets setup, it’s time to format them to your liking. Your print stylesheet should start by being identitcal to your screen stylesheet. Then begin hiding all the elements that you don’t want to show up in your print out using either display: none; or position: absolute; left: -9999px;. In most cases it’s best to use the latter method to hide elements as screen readers sometimes ignore display: none;. However, in this case, it shouldn’t make a difference.

Best practices for printer-friendly websites

Here are 5 best practices to follow when deciding how the print version of your website should appear:

  1. Strip all or most images.
  2. Remove background colors.
  3. Minimize and adjust text colors - use colors that will be easy to read on paper.
  4. Remove unecessary or irrelevant elements (such as links).
  5. Add necessary information such as the webpage’s URL or contact information.

Tip: Trading Places

Here’s a simple tip that will help you swap web content that is irrelevant or unfriendly for print with useful and printer friendlier content.

For example, here is the header image on MichelleLuDo.com:

MichelleLuDo Header Image

In the printed version of the site we wanted to make sure that her name was still visible and that branding stayed in tact. However, printing this image would not be too friendly on the printer’s ink or on the overall aesthetics of the print out (since all other background colors will have been stripped). What we want to do is replace the header image above with this printer friendly header image in the printed version of the website:

MichelleLuDo.com Header Image (Printer Friendly)

So here’s how we do it:

HTML

<div id="header-image">
<span class=”normal”><a href=”/” title=”Michelle Lu-Do”><img src=”id.jpg” alt=”Michelle Lu-Do”></a></span>
<span class=”pf”><img src=”id_pf.jpg” alt=”Michelle Lu-Do”></span>
</div>

Screen Stylesheet

#header-image { padding-top: 40px; float: left; display: block; width: 530px; height: 41px; }
#header-image .normal { }
#header-image .pf { display: none; }

Note that the <span class="pf"> that wraps our printer-friendly header image (id_pf.jpg) is hidden using display: none;, while the <span class="normal"> that wraps our web-ready header image is displayed.

Print Stylesheet

#header-image { padding-top: 40px; float: left; display: block; width: 530px; height: 41px; }
#header-image .normal { display: none; }
#header-image .pf { }

Notice now that .normal and .pf have traded properties and now the ‘normal’ web-ready header image is hidden while the printer-friendly header image is displayed for the printer. Just like that, our printer-friendly image has traded places with the web-friendly image. You can use this hepful tip with any content on the page.

The final product

Here’s a live page from MichelleLuDo.com:

MichelleLuDo.com

And here’s how the page prints out:

MichelleLuDo.com (Printed)

And there you have it, an accessible printer-friendly website.

9 Comments

Tags: , ,

3 ways to clean up your Google search results

February 9th, 2008 by Verne

It’s not quite Spring yet, but we’ve been spending time doing some cleaning. If you’ve owned a server for several years, you’ll know that over time things can get messy. In fact, if you do a quick Google site search (site:www.yourdomain.com), what you end up seeing is a long, and sometimes ugly, history of every page and file you’ve ever publically offered.

A big part of our recent new site launch was cleaning up our old links to ensure that our audience was finding the most relevant content in major search engines like Google. Our server currently hosts thousands of pages and files - some we publish for the public, some we like to keep private. Targeted campaign pages, internal or upcoming project sites, and client work are examples of areas of our server that we’d rather not have someone find while doing a search query.

Knowing this, we’ve implemented a few tools to help keep our search results clean and tidy. Below you’ll find 3 simple steps to follow that will help you do the same.

1. META Tags

Here’s the first place you want to start. You can add a simple META tag to the top of every live page you have (between the <head> and </head> tags) and configure it to your liking. Here’s how the META tag should look:

<meta name="robots" content="noindex, nofollow">

noindex signifies that site crawlers should not index the page. Alternatively, writing index would tell crawlers to index the page.

nofollow signifies that links on this page should not be tracked or given credit for (alternatively, follow would track links). nofollow is also used commonly for individual links with the rel="nofollow" attribute when web publishers don’t want to get punished for linking to suspicious sites.

By default, every page is tagged as “index, follow”, but changing this attribute can help you configure your pages in a few different ways (4 to be exact).

WordPress Meta Robots Plugin

For WordPress users, you can install the Meta Robots plugin. This will allow you to configure each and every post and page from the editor, as well as configure the global settings of your site.

WordPress Robots Meta Plugin

2. Robots.txt

Tagging each and every one of your pages with META tags can be tedious. Sometimes, it makes sense to simply block an entire directory from being crawled. To do this, create a file, name it robots.txt, and upload it into the root of your server (i.e. it should reside at www.yourdomain.com/robots.txt).

The contents of your robots.txt file should look something like this:

User-agent: *
Disallow: /private/
Disallow: /internal/

User-agent refers to the specific site crawler bots that you would like to block from accessing your directories. For example, you may want to only block Google’s bots but allow all others. In this case, you would write User-agent: Google (the name of each bot varies and will require some additional research to find it). A * means that you are targeting all bots.

Beneath user-agent, you can list out each directory you would like to have blocked. When a directory is blocked, so are all of its subdirectories, so be careful!

Note that a robots.txt file can also block individual pages and files, so it can be used as a substitute to using META tags.

3. Google Webmaster Tools

Thus far I’ve only shown you ways to avoid having new pages or directories picked up by search engines. If your pages have already been indexed then you’ll need to take one extra step to have it removed. That’s where Google Webmaster Tools comes into play.

Google Webmaster Tools is a great place for site owners to manage how their site is being indexed by Google. There are a multitude of different features to this site, but I’ll only be covering one particular one - the Remove URLs feature. However, if you are a site owner, I strongly encourage you to sign up to this free service and browse around.

Once you’ve registered/signed-in and verified that you are the actual site owner, click Tools and then Remove URLs on the left navigation.

Google Webmaster Tools

You’ll notice at the top of the page, there are one of three things you must do before being able to submit a Removal Request. For a directory/page/file to be removed from Google’s index, you must do one of the following:

  • Make sure the content is no longer live on the web. Requests for the page or image you want to remove must return an HTTP 404 (not found) or 410 status code.
  • Block the content using a meta noindex tag.
  • Block the content using a robots.txt file.

In other words, you must either delete the directory/page/file from your server, or do one of the 2 things I’ve already discussed.

Once this has been done, go ahead and click the New Removal Request button. You’ll find that Google gives you 4 options to choose from:

Google Webmaster Tools - Remove URLs

Choose an option and submit your request. Your request will be added to a Pending list of requests, and approximately 24 hours later, if all goes well and all requirements have been satisfied, you’ll find that your requests will have been fulfilled and your directory/page/file will have been removed from Google’s index.

Closing Notes

This tutorial is focused on only cleaning up your search results on Google. While it is the leading search engine today, there are a number of other major engines to also share your attention with.

In any case, cleaning up your search results is an important maintenance task for all site owners as it helps you ensure that your audience will only find content that’s current and relevant. Performing the 3 simple tasks in this tutorial on a regular basis will greatly help you take control over what people are finding on your site and help clean up your search results.

3 Comments

Tags: ,

Vertically center content with CSS

January 31st, 2008 by Verne

A convenient benefit of using tables is the ability to vertically center content within a cell using the valign attribute. Unfortunately, acheiving the same effect with CSS isn’t so convenient. So, as we continue to move towards tableless structures, there comes a need for a simple and valid CSS alternative. There have been a number of ways to approach this feat, but in this tutorial, I will lay out the technique we use to vertically center content using CSS.

The HTML

Three divs are required in order to pull this one off. Here’s an example of how we setup the divs.

<div id="container">
<div id=”position”>
<div id=”content”>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec laoreet egestas mi. Aliquam erat volutpat. Aliquam erat volutpat. Suspendisse potenti. Suspendisse potenti. Vestibulum mi nibh, hendrerit nec, feugiat vitae, feugiat a, nisl.
</div>
</div>
</div>

The #container div is used as the main reference point for centering the content. In other words, the content will be vertically centered against the height of the #container div.

The #position div is used to, naturally, position the content.

Finally, the #content div is used to encase the actual content that we are trying to center. This div is also used to correct the positioning of the content for Internet Explorer users (as you’ll see later).

The CSS

Here’s the CSS we apply to make it all come together:

<STYLE type="text/css">
#container { width: 100%; height: 100%; display: table; }
#position { display: table-cell; vertical-align: middle; width: 100%; text-align: center; }
</STYLE>

We’ve defined the height of #container to be the full height (100%) of the page. We could have just as easily given it a fixed height such as 500px. We’ve also added display: table and display: table-cell to #container and #position, respectively, which will tell it to mimic the properties of <table> and <td>.

You’ll notice that we haven’t applied any style to the #content div. This is because browsers like Firefox and Safari are able to use the uber handy vertical-align: middle property, making it almost just as easy as using tables. Using only the code we’ve shown thus far, our content should be nicely vertically centered on the page in all browsers except Internet Explorer, which doesn’t understand vertical-align: middle.

To correct this problem and ensure that our content is still vertically centered for IE users, we’ll apply the following conditional statements and extra bits of CSS.

<!--[if IE]>
<STYLE type="text/css">
#container { position: relative; }
#position { position: absolute; top: 50%; }
#content { position: relative; top: -50%; }
</STYLE>
<![endif]–>

The <!--[if IE]> … <![endif]–> tags tell the browser to only process this CSS if the browser being used is Internet Explorer.

When processed, the CSS places the top margin of the #position div halfway down the height of #container. However, this only places the content in the lower half of #container. So, to center it vertically, #content’s top is offset by -50%. That is, it is being shifted upwards a distance that is equal to 50% of its height. If you do the math and crunch the numbers in your head, you’ll find that this does a nice job of centering the content.

Live Demo

A live demo of this tutorial is available here. You can also download the demo page for your reference.

33 Comments

Tags: ,

Can’t wait for next Christmas

January 8th, 2008 by Verne

In early December, we launched a holiday microsite entitled Can’t Wait for Christmas that encouraged visitors to post their wishes and share exactly what they couldn’t wait for come Christmas day. The site was a hit and we happily received almost 300 unique wishes from people all around the world. More interestingly, the site was conceived, designed, developed, and launched in less than 19 hours.

The site was simply a great in-house project that let us flex our WordPress muscles a bit. In fact, a detailed tutorial on some of the WP techniques used in the making of Can’t Wait for Christmas has been posted here. And if you’re a real keener, you can learn more about the project by reading mine and Satish’s interview about the site over at HatchThat.com.

Thanks to everyone who stopped by and shared their wishes and counted down the days, hours, minutes, and seconds til Christmas with us. Hope you all had a merry one!

2 Comments

Tags: , ,