Your Guide to Website Design and Management

Text Size:
small_A.gif small_A.gif
Bookmark and Share

Rating: 0.0/5 (0 votes)

Site Design (Architecture, Coding, UI, etc.) >> Common Website Features >>

Text Size Switcher

"For people who make websites" - A List Apart Magazine explores the design, development, and meaning of web content, with a special focus on web standards and best practices.
HTML Validator is a Mozilla extension that adds HTML validation inside Firefox and Mozilla. The number of errors of a HTML page is seen in the form of an icon in the status bar when browsing. The details of the errors are seen when looking the HTML source of the page.

The extension is based on Tidy and OpenSP. Both algorithms were originally developed by the Web Consortium W3C. Both algorithms are embedded inside Mozilla/Firefox and makes the validation locally on your machine, without sending HTML to a third party server.
This project aims to create an archive of user contributed clip art that can be freely used.
Starting at the beginning, this reference explains everything you need to know about using core JavaScript. It assumes you have the following basic background: a general understanding of the Internet and the World Wide Web and a good working knowledge of HTML. An excellent resource.
Edit your images on the fly online with Splashup, a web-based image editor that integrates with Flickr, Facebook, and Picasa. Splashup offers up a surprising array of image editing tools, far beyond the usual crop of resize and contrast-- you can also edit multiple images, play with filters and layers, use a variety of brushes, and more. Splashup is one of the best image editors in a long line of image editors; i.e., Picnik, Pixoh, and Resizr, to name just a few.[Lifehacker Annotation]
This website will let you:
  • Create an XML sitemap format that can be submitted to Google to help them crawl your website better.
  • Create a Text sitemap to submit to Yahoo.
  • Create a ROR sitemap, which is an independant XML format for any search engine.
  • Generate an HTML site map to allow human visitors to easily navigate on your site.
Clearspring's free Launchpad widget builder lets you easily turn your website's content into a widget which site visitors can use to place your content on all the major social media sites (MySpace, FaceBook, Google, hi5, Live, Yahoo, Wordpress, Blogger, etc.). The service also provides tracking and analysis.
This site features online text and html changing, modifying, converting tools designed to save you time making web pages or preparing text for web publication. If you've ever needed to capitalize sentences or convert line breaks to <p> or <br /> then this site can save you needless manual labor. There are other useful tools as well, like the one to uncompress html to make it readable and the ones to uppercase or lowercase text. Basically, the most common tasks that someone who works in an office or does freelance web development might encounter. Most of the tools have been created using javascript so you should be able to change large amounts of text as the processing is done on your computer instead of being limited by a server script.
dTree is a free JavaScript tree menu. That is very simple to set up and use. You don't have to worry about adding pages to the tree in a specific order, which makes it ideal for generating a tree from a database.
webmaster toolkit offers this CSS Menu Generator to generate both the CSS and the HTML code required to produce a text-based yet appealing set of navigation buttons.
Amaya is an open source Web editor endorsed by the W3C. Browsing features are seamlessly integrated with the editing and remote access features in a uniform environment. This follows the original vision of the Web as a space for collaboration and not just a one-way publishing medium.

Amaya started as an HTML + CSS style sheets editor. Since that time it was extended to support XML and an increasing number of XML applications such as the XHTML family, MathML, and SVG. It allows all those vocabularies to be edited simultaneously in compound documents.
A very flexible unlimited-level, drop down JavaScript menu that uses UL/LI list data formatted with a CSS menu layout. It's powerful, lightweight and extremely easy to use!
CSS Tab Designer is unique and easy to use software to help you design css-based lists and tabs visually and without any programming knowledge required! Read a review.
This document guides you through the process of using JavaScript and the DOM to build a three-state toolbar that accurately and efficiently handles different button states (normal, highlighted, selected), and the interdependencies between them.
The Search Engine Friendly Layouts website has been created for both the webmaster and the search engine optimization specialist. The layouts on the site are all designed to be web standards-compliant, yet also search engine friendly. These layouts have all been created by Adam Senour, and he gives them to you at no cost whatsoever.
Open Source Web Design is a site to download free web design templates and share yours with others. We help make the internet a prettier place.
Some of us have a great eye for complementary colors and matches--and then some of us still don't understand why brown shoes and black pants are a bad idea. For anyone looking to set an image against a complementary background or find a color scheme, Whats Its Color (their grammar, not mine) is a free web app that can help. Upload an image and the site creates a palette page with a complementary background and a list of unique and dominant colors in your image. Photoshop and GIMP gurus might already know how to sift these kind of things already, but the visible color matching could be a boon for presentation slides or small design projects.
This tutorial will teach you all you need to know to be able to craft powerful time-saving regular expressions. It starts with the most basic concepts, so that you can follow this tutorial even if you know nothing at all about regular expressions yet. It will also explain how a regular expression engine works on the inside, and alert you at the consequences. This will help you to understand quickly why a particular regex does not do what you initially expected. It will save you lots of guesswork and head scratching when you need to write more complex regexes.
FastStone Capture is a powerful screen capture utility with built-in editing tools. It allows you to capture anything on the screen including windows, objects, menus, full screen, rectangular/freehand regions and scrolling windows/web pages. It sends captures to editor, file, clipboard, printer, email, Word/PowerPoint document or even your website. Editing tools include resizing, cropping, sharpening, annotating, applying effects, watermarks and many more. It saves captures in BMP, GIF, JPEG, PCX, PNG, TGA, TIFF and PDF formats. Additional features include a small handy capture panel that offers quick access to its capture tools and output options, global hotkeys, automatic filename generation, support for external editors, a color picker, a screen magnifier and a screen ruler.
An online picture editor, pikifx.com emphasizes special effects. You can use it to: - Resize and Crop, - Add creative effects, - Add borders, - Add creative text
Don't embarrass yourself by busting out the same tired stock clip art for your next Power Point tour de force. WPClipart has a pile of royalty free images to share.

The archive currently has 23,872 images, covering thousands of subjects. A significant portion of them are in lossless formats. The site is organized into categories, but if casual browsing fails to find you the perfect gem you've been searching for there is always keyword based searches. You can even download the entire collection as a single archive, making it easier to use offline. [Lifehacker Annotation]
If you need a logo but you're lacking the design chops to whip one up, score a free one at LogoInstant. LogoInstant is a design service that cranks out a new logo every day. The logos are completely free for both personal and commercial use and come in a layered Adobe Photoshop source file so you can edit the name or make more advanced changes.[LifeHacker Annotation]
LogoYes is a site offering a flash program to create logos. Just select your industry, a symbol, text, typography and colors for your logo. Once you finish, you can purchase a high-resolution file with your logo for only $69 or include a business card design based on the logo for an additional $30.
99designs helps you run a "design contest", where thousands of designers compete to create the best possible design to meet your needs. All you need is a clear idea of what you want designed and how much you're prepared to pay for it.
If you've been having trouble finding free or Creative Common-licensed photos for use in your projects, Sprixi filters out the fluff to help you find the images you really want.
One of the frustrations of searching for anything on the internet, let alone images, is imprecise search results. If you've ever searched for something and found something completely different—usually because the file name or the associated keywords were strangely or inappropriately applied—then you know what we're talking about.
Sprixi helps circumvent the strangeness of file names and misapplied keywords by letting users vote on whether or not an image is really what they were looking for. Search for "school bus", for example, and get some images of a micro-processor bus and you can flag them as not helpful to your search. Because thousands of users have come before you, analyzing the images, you won't often find misplaced images. Search results are divided into sorted and unsorted images, with the sorted images on top—sorted in this case means that users have verified that the images do in fact contain the thing you are looking for.
Sprixi currently pulls images from Flickr, OpenClipart.org, and from user uploads. Sprixi is a free service and requires no registration or login to use. [Lifehacker Annotation]
It's a tug-of-war as old as web design. Designers need to control text size and the vertical grid; readers need to be able to resize text. A better best practice for sizing type and controlling line-height is needed; and in this article, Richard Rutter obligingly supplies one.

A useful and common accessibility feature is a text size switcher. This is a tool that allows users to alter the size of the text on a Web page, usually to make it larger and therefore easier to read. Some browsers come with this feature built-in, but inexperienced users may not know about it. For these users you can place easily-accessible control buttons for this purpose on each Web page.

This feature is usually implemented using JavaScript CSS and cookies but you can implement a PHP, CSS and sessions switcher as well. The drawback of using PHP is that you need to make a call to the server to reload the page whereas a JavaScript solution is handled on the client side. The advantage of using PHP instead of JavaScript is that you're not dependent on the client supporting JavaScript, nor do you need to worry about creating browser-specific workarounds.

A text size switcher is yet another example of the power of CSS. By defining sections of your page via CSS, you can add text size controls for individual page sections or the entire page. Since many people use menus and sidebars that don't scale well, being able to increase the size of just the main text is quite helpful. Of course, with some creativity you could change multiple sections or even load completely different external CSS files as well.

I often see 2 or 3 sizes offered (small, medium, large), but I personally prefer a more flexible solution with two choices – increase text size and decrease text size. Below I illustrate both approaches.

Offer Multiple Font Size Choices


I found the following code on the ESPN website (found on their articles pages, not the main page). In the following, you will need to replace domain.com with your domain name and change .main to the style name you are using for the section you want to resize.

/* ============================================================= */
/* The following function allows user to set multiple font sizes */
/* ============================================================= */
<script language="JavaScript"> <!--
function setFontCookie(name, value) {
 var curCookie = name + "=" + escape(value) + "; expires=Wed, 07-Jun-2023 11:07:25 GMT; path=/; domain=domain.com";
 document.cookie = curCookie;
 window.location.href = window.location.href;
}

function getCookie(name) {
 var dc = document.cookie;
 var prefix = name + "=";
 var begin = dc.indexOf("; " + prefix);
 if (begin == -1) {
       begin = dc.indexOf(prefix);
       if (begin != 0) return null;
 } else
       begin += 2;
 var end = document.cookie.indexOf(";", begin);
 if (end == -1)
       end = dc.length;
 return unescape(dc.substring(begin + prefix.length, end));
}
if (getCookie('fontsize') == null) {
       var fontsize = 11;
} else {
       var fontsize = getCookie('fontsize');
}

function changeFontSize (direction) {
       setFontCookie('fontsize',fontsize);
}

document.write('<style> document.write('.main {font-size:'+fontsize+'px;line-height: 150%;15px;color: #000;padding: 0px 0 30px 0px;}');
document.write('</style>');

//-->
</script>
/* ====================================================== */


In the HTML code, ESPN uses the following:

<script language="JavaScript">        document.write('<!-- fontsize=' + fontsize + '-->')

       if (fontsize == 10) {
              document.write('<div class="ft2at"><a href="#" onClick="changeFontSize(10); return false;"><img src="http://www.soccernet.com/design05/i/story/small_A.gif" alt="small_A.gif" width="16" height="16" hspace="1" vspace="1" border="0" /></a></div>');
       } else {
              document.write('<div class="ft2"><a href="#" onClick="changeFontSize(10); return false;"><img src="http://www.soccernet.com/design05/i/story/small_A.gif" alt="small_A.gif" width="16" height="16" hspace="1" vspace="1" border="0" /></a></div>');
       }

       if (fontsize == 11) {
              document.write('<div class="ft2at"><a href="#" onClick="changeFontSize(11); return false;"><img src="http://www.soccernet.com/design05/i/story/medium_A.gif" alt="small_A.gif" width="16" height="16" hspace="1" vspace="1" border="0" /></a></div>');
       } else {
              document.write('<div class="ft2"><a href="#" onClick="changeFontSize(11); return false;"><img src="http://www.soccernet.com/design05/i/story/medium_A.gif" alt="small_A.gif" width="16" height="16" hspace="1" vspace="1" border="0" /></a></div>');
       }

       if (fontsize == 14) {
              document.write('<div class="ft2at"><a href="#" onClick="changeFontSize(14); return false;"><img src="http://www.soccernet.com/design05/i/story/big_A.gif" alt="small_A.gif" width="16" height="16" hspace="1" vspace="1" border="0" /></a></div>');
       } else {
              document.write('<div class="ft2"><a href="#" onClick="changeFontSize(14); return false;"><img src="http://www.soccernet.com/design05/i/story/big_A.gif" alt="small_A.gif" width="16" height="16" hspace="1" vspace="1" border="0" /></a></div>');
       }

       if (fontsize == 20) {
              document.write('<div class="ft2at"><a href="#" onClick="changeFontSize(20); return false;"><img src="http://www.soccernet.com/design05/i/story/real_big_A.gif" alt="small_A.gif" width="16" height="16" hspace="1" vspace="1" border="0" /></a></div>');
       } else {
              document.write('<div class="ft2"><a href="#" onClick="changeFontSize(20); return false;"><img src="http://www.soccernet.com/design05/i/story/real_big_A.gif" alt="small_A.gif" width="16" height="16" hspace="1" vspace="1" border="0" /></a></div>');
       }

</script>


which looks like the following on their sidebar:


Offer Flexible Increase/Decrease


To get a more flexible increase size and decrease size setup, I just modified the code above (specifically the changeFontSize function) as follows:

/* ======================================================================= */
/* The following function allow user to increase or decrease the font size */
/* ======================================================================= */
<script language="JavaScript"> <!--
function setFontCookie(name, value) {
 var curCookie = name + "=" + escape(value) + "; expires=Wed, 07-Jun-2023 11:07:25 GMT; path=/; domain=domain.com";
 document.cookie = curCookie;
 window.location.href = window.location.href;
}

function getCookie(name) {
 var dc = document.cookie;
 var prefix = name + "=";
 var begin = dc.indexOf("; " + prefix);
 if (begin == -1) {
       begin = dc.indexOf(prefix);
       if (begin != 0) return null;
 } else
       begin += 2;
 var end = document.cookie.indexOf(";", begin);
 if (end == -1)
       end = dc.length;
 return unescape(dc.substring(begin + prefix.length, end));
}
if (getCookie('fontsize') == null) {
       var fontsize = 11;
} else {
       var fontsize = getCookie('fontsize');
}

function changeFontSize (direction) {
       if (direction == "decrease") { fontsize--; fontsize--; }
       if (direction == "increase") { fontsize++; fontsize++; }
       setFontCookie('fontsize',fontsize);
}

document.write('<style> document.write('.main {font-size:'+fontsize+'px;line-height: 150%;15px;color: #000;padding: 0px 0 30px 0px;}');
document.write('</style>');

//-->
</script>
/* ======================================================================= */


Now, in my HTML, I use something like:

<div class="changetextsize">
<a href="#" onClick="changeFontSize('decrease'); return false;"><img src="/images/dec-text.gif" alt="decrease text" width="21" height="15" align="texttop" border="0" /> Decrease Text Size</a> &nbsp; <a href="#" onClick="changeFontSize('increase'); return false;"><img src="/images/inc-text.gif" alt="increase text" width="21" height="15" align="texttop" border="0" /> Increase Text Size</a> &nbsp;
</div>


which looks like:


Obviously, with imagination you can come up with your own modifications to this idea. And, the script I borrowed from ESPN can easily be replaced by a different one but I'll leave that up to you to explore.

Text Size:
small_A.gif small_A.gif
Bookmark and Share



Trackbacks »