- June 5th, 2008
- 143 Comments
Style switchers are used to provide users with a choice of layouts, fonts, colors and views they can use to adapt the design to their personal needs. Designs with style switchers are more flexbile, more adaptive and more user-friendly as different visitors can quickly modify the design for their personal convenience.
When offering different layouts and design variations your design may better suit the preferences of your visitors. After all, it is almost impossible to make the design look nice and work properly for everybody. Style switchers are also used in web-sites which emphasize the usability and accessibility in their designs.
Style Switchers Contest
Web designers can achieve significant usability-improvements by adding a simple style switcher to their designs. Style switchers are useful and powerful as they give users a better control of site presentation. However, this technique is almost never used and are sometimes considered to be unnecessary and useless which is simply not true. We would like to change it.
We want to motivate you to figure out how style switchers work and how you can use them to improve your designs.
We’d like you to create beautiful, functional and user-friendly style switchers for your own web-sites. We’ll collect the most creative, usable and elegant solutions and review them in one of our next posts.
The award is Apple Cinema 20 Flat Panel Display with 16.7 million colors, 400:1 contrast ratio, 0.258 mm dot pitch, 16 ms response time and 170-degree viewing angles (see the image below). The winner will be chosen randomly among participants of our contest.
How do I participate?
To participate, just
- design a style switcher for your site,
- integrate it and make sure it works,
- put the plain text “Smashing Magazine” (without a link) on your site. No matter where: it has to be visible and can be deleted afterwards (we need to identify you as the owner of a web-site),
- and post the URL of your site with a style switcher in the comments to this post.
One person may submit at most 3 style switchers. However, the style switchers should be different and should be used on different web-sites.
The site with a style switcher must be online and work after the deadline. Spam will be blacklisted, so the link will never appear in our posts again.
19.06.2008. The comments will be closed at 00:01 on 20.06.2008.
The information provided below is supposed to help you to get started with style switchers.
How does a style switcher work?
When the visitor clicks on style switcher, a script changes the stylesheet on the fly, thus presenting the old content in a new layout. Let’s consider the following, very basic example. Peter Sach2 uses 4 small icons to indicate different versions of the site design. In each of these cases the background image is different. When a visitor clicks on one of the icons, the design changes.
The site offers four design variations:
A style switcher, or design elements which are supposed to stand for the style switcher (buttons, icons, plain text), can appear everywhere, but not in the footer. Style switcher isn’t really useful it it isn’t seen at all or is seen too late. In most cases icons or plain text are used.
So what can you really do with a style switcher?
1. Let the user choose an optimal font size
font size-style-switchers are probably the most popular style switchers in the design landscape. Your designs can enable visitors to choose an optimal font size which best fits to his or her personal preferences. Of course, users can achieve the same via their browser, however a style switcher is more comfortable. In best case, the font size, once selected, should remains the same on all pages of a given site. To achieve this you need to store font size settings via cookies. Style switcher can do that, but no browser is able to achieve it — unless the visitors use some specific extensions such as Userscripts6.
Let’s take a look at some examples of how style switchers for font size adjustment can be integrated in site designs. Often the choice of font size is displayed via a sequence of growing letters, in most cases “a”.
Hand-drawn style-switcher is sometimes also an option worth considering:
The selection of font size can be done via plain text link, too:
Active setting can be highlighted via vibrant colors, e.g. with the red:
…or via vibrant background color, e.g. with the orange:
Sometimes the label for style switcher is A+ or A- :
You can also use visual elements, e.g. icons such as magnifying glass to indicate the font size adjustment:
Buttons can be used as well to indicate the font size adjustment:
Another option is to display two letters in different sizes next to each other. This solution, however, should somehow link to settings adjustments as it is not really clear how one can decrease the font size once it was increased. The icon on the left stands for an alternative color contrast.
2. Let the user choose an optimal typeface
Apart from font size settings you can also let the user manually define the typeface he or she would like to use to read your content. Of course, it is necessary to make sure that the settings are stored in cookies, so the visitor doesn’t have to define the setting on every page over and over again.
Unfortunately, only few sites make use of this technique. Mike Davidson24 lets his visitors manually define the font size and the font for his content. Ultimately, own typeface can be specified as well. Simple and user-friendly. Besides, Mike also offers 4 different design layouts as well as a mobile version of the site. If you want to make sure that your visitors feel that the designer has actually though about their needs, this is a style switcher you should integrate in your designs.
Usability.com.au26 uses an extra-sidebar at the right hand side to let users define accessibility settings. Among other things one can define whether sans-serif-typeface or a serif-typeface should be used.
3. Let the user choose an optimal text presentation
Font size, font family, what else? Well, when it comes to the presentation of text, one usually has to decide whether the text should be presented left-aligned or justified. One can let the visitors decide it too. One should mention that left-aligned text doesn’t work well in Web, though. Reason: modern browsers don’t have a sophisticated hyphenation algorithm for “parsing” text in a readable manner — the way we know it from print. It may change in the future, though.
Sometimes one can simply use plain text to provide users with the choice. Visitors from Arabian countries may prefer right-aligned text.
4. Let the user choose an optimal design
What is possible with fonts is, of course, also possible with designs. Designers often present multiple variations of site designs, usually color scheme variations, dark/bright-schemes and design with low and high color contrast. This is very useful from the accessibility point of view. If your web-site is likely to attract a number of senior users you definitely have to integrate a contrast switcher in your design.
An almost minimalistic, but pretty colorful style switcher is presented by Urbanchip35, a design agency from Argentina. The site lets its visitors select one of 5 stylesheets for the site. The selected theme is stored in users’ cookies.
5. Let the user choose an optimal contrast
From the usability and accessibility point of view one can present visitors multiple designs, but one should also consider presenting visitors designs with various color contrast. Such switchers are also called contrast switchers.
In most cases, to make sure the content is readable it is enough to have a basic stylesheet with very light text on very dark background. Not every design is optimized for a good color contrast which is where a contrast switcher can help. Roger Johansson45 has one.
Popurls.com49 is probably the king (or queen) of style switchers. The site lets its visitors to define a variety of preferences such as whether the links should be opened in new window and how large the fonts should be. Of course, contrast switcher is also offered. Users can also arrange content blocks and select content layout.
Merixstudio53 hides the link to a high contrast version at the right upper corner of the design. The “high contrast” version removes all gradients and uses strong and vibrant colors. The design itself changes slightly, but effectively.
6. Let the user choose an optimal layout
You can also provide your visitors with the option to define the width of the layout and the layout itself. Most used solution is a style switcher between tiny and wide layouts which is supposed to let users with various screen resolutions see the site a way they want to.
Phonophunk57 has a quite distinctive layout-switcher. The used icons may not be clear enough for new visitors. Here the layout is really flexible. The sidebar can be placed to the right or to the left (two icons in the middle), two other icons stand for a tiny and wide layout.
ShopComposition61 has a very unusual and extremely adaptive design layout. Visitors can switch between different views and define the width of the blocks. That is not really a style switcher, but the idea is interesting and can definitely be used for an effective style-switcher.
One can also use a <select>-element to let the user make his or her choice:
Not beautiful, but quite switchy: users can change the font-size and the width of the layout:
dfTheme67 is one of the few themes which have a sophisticated style switcher integrated in the theme. Users can change the font size and the width of the layout. The theme is available for WordPress, Drupal CMS and Joomla CMS.
How do I implement a style switcher?
To embed multiple style sheets in your site you simply need to embed each of them using the <link>-tag and the corresponding relation. That’s not a big secret since designers have been doing it for years — e.g. to integrate a print-layout in the design.
Let’s consider the following example:
<link href="css/layout.css" rel="stylesheet" type="text/css" title="Standard Layout" /> <link href="css/alt-layout.css" rel="alternate stylesheet" type="text/css" title="High Contrast Layout" />
By default the style sheet
layout.css will be used. A style switcher should now make it possible to switch to alternative style sheet
Using any modern web-browser users can manually switch between the themes offered on a web-site (see the screenshot below). However, nobody is actually browsing from site to site looking for a style switchers (well, nobody except of us). Hence when simply included in HTML, alternate stylesheets are very likely to be overlooked. To make sure your visitors are aware of them you need to make them visible in your design.
Style sheets can be chosen with Firefox
Finally, an overview of tutorials, how-tos, style-switcher-scripts and resources you can use to develop your style switcher.
Tutorials and Style-Switcher-Scripts For Free Download
- How to create a CSS style switcher70
- CSS Style Switcher71
- Build your own PHP style sheet switcher72
- Stuff and Nonsense: Strategies for CSS Switching73 (Digital-Web)
- Alternative Style: Working With Alternate Style Sheets74 (ALA’s classic from 2001)
- Build A Simple Style Switcher in CSS75
- Fast CSS Style Switching with PHP76
- Style Sheet Switcher (v1.1)77 (DynamicDrive)
- Mootools Styleswitcher78
- Designing a Style Switcher79
- Introducing UDASS80
- Invasion of the Body Switchers81
- Time-based Style Theme Switcher82
- Layout Changer
- Build a PHP Switcher83 (A List Apart)
- Switch stylesheets with jQuery84
- Style Switcher in ASP
- Server-Side Dynamic Style Sheet Switcher85
- Invasion of the Body Switchers86
- CSS Style Switcher Using PHP89
- Stylesheet Switching with PHP90
- Advanced CSS Style Switcher91
- CSS Style Switcher Tutorial 92
- PHP Styleswitcher: Version 2 Tutorial93
- Style Switcher Perl Script94
- Styleswitcher – PHP-Modell95 (German)
- Stichpunkt Style Switcher96 (German)
Style Switcher with WordPress Plugins
Good luck, folks!
- 1 http://www.smashingmagazine.com/images/styleswitcher/apple.jpg
- 2 http://www.ps-designstudio.de/
- 3 http://www.ps-designstudio.de
- 4 http://www.ps-designstudio.de
- 5 http://www.ps-designstudio.de
- 6 http://userscripts.org/
- 7 http://www.clusty.com
- 8 http://clusty.com
- 9 http://alexking.org/blog/2004/02/03/css-style-switcher-updated
- 10 http://alexking.org/blog/2004/02/03/css-style-switcher-updated
- 11 http://splitdadiz.com/
- 12 http://splitdadiz.com/
- 13 http://oink.elrellano.com/index.php
- 14 http://www.vladstudio.com
- 15 http://monozellen.de/
- 16 http://www.daihatsu.com/
- 17 http://www.fabrik1design.com/
- 18 http://webagentur-meerbusch.de/
- 19 http://www.typo3advanced.de/
- 20 http://www.pookerart.de/
- 21 http://www.fromustoyou.de
- 22 http://webdesign.weisshart.de/
- 23 http://webdesign.weisshart.de/
- 24 http://www.mikeindustries.com/blog/
- 25 http://www.mikeindustries.com/blog/
- 26 http://usability.com.au/
- 27 http://usability.com.au/
- 28 http://whatdoiknow.org/
- 29 http://whatdoiknow.org/
- 30 http://www.contentschmiede.de/
- 31 http://opencomp.de/
- 32 http://opencomp.de/
- 33 http://www.mariusroosendaal.com/
- 34 http://www.mariusroosendaal.com/
- 35 http://www.urbanchip.com.ar/
- 36 http://www.urbanchip.com.ar/
- 37 http://www.wishtree.org/
- 38 http://www.wishtree.org/
- 39 http://www.diegovalobra.com
- 40 http://www.diegovalobra.com
- 41 http://www.werkbot.com
- 42 http://www.werkbot.com
- 43 http://dsmagic.com/
- 44 http://dsmagic.com/
- 45 http://www.456bereastreet.com/
- 46 http://www.456bereastreet.com/
- 47 http://www.sas-foto.de/index.php?/P1/
- 48 http://www.sas-foto.de/index.php?/P1/
- 49 http://www.popurls.com/
- 50 http://www.popurls.com/
- 51 http://www.dustindiaz.com
- 52 http://www.dustindiaz.com
- 53 http://www.merixstudio.com/
- 54 http://www.merixstudio.com/
- 55 http://www.excusemeplease.org
- 56 http://www.excusemeplease.org
- 57 http://phonophunk.com/
- 58 http://phonophunk.com/
- 59 http://bestwebgallery.com/
- 60 http://bestwebgallery.com/
- 61 http://www.shopcomposition.com/
- 62 http://www.shopcomposition.com/#Projects
- 63 http://www.einfach-fuer-alle.de/
- 64 http://www.einfach-fuer-alle.de/
- 65 http://charlier.de/
- 66 http://www.naiz.de/joomla/
- 67 http://www.dezinerfolio.com/2008/01/23/dftheme-for-joomla/
- 68 http://joom.dezinerfolio.com/
- 69 http://opencomp.de/
- 70 http://www.inetsolution.com/css-style-switcher-how-to.asp
- 71 http://designshack.co.uk/tutorials/css-style-switcher
- 72 http://www.456bereastreet.com/archive/200608/build_your_own_php_style_sheet_switcher/
- 73 http://www.digital-web.com/articles/strategies_for_css_switching/
- 74 http://www.alistapart.com/articles/alternate
- 75 http://www.sitepoint.com/article/css-simple-style-switcher
- 76 http://www.fiftyfoureleven.com/weblog/web-development/css/fast-css-style-switching-with-php
- 77 http://www.dynamicdrive.com/dynamicindex9/stylesheetswitcher.htm
- 78 http://www.mensching.info/program/mootools-styleswitcher-en.html
- 79 http://centerkey.com/style/switcher/
- 80 http://24ways.org/2005/introducing-udasss
- 81 http://www.alistapart.com/articles/bodyswitchers/
- 82 http://blog.e-ss.be/2007/04/25/css-style-theme-switcher/
- 83 http://www.alistapart.com/articles/phpswitch
- 84 http://www.kelvinluck.com/article/switch-stylesheets-with-jquery
- 85 http://juicystudio.com/article/stylesheet-switcher.php
- 86 http://www.brothercake.com/site/resources/scripts/iotbs/
- 89 http://www.csswoes.com/2008/05/02/css-style-switcher-using-php/
- 90 http://alterior.net/archives/000021.php
- 91 http://www.sitereboot.com/read_tutorial.php?id=6
- 92 http://ppleyard.org.uk/archives/2005/01/01/css-style-switcher-tutorial.html
- 93 http://www.contrastsweb.com/switcher/v2/tutorial.php
- 94 http://www.excusemeplease.org/computers/perl_stuff/styleswitcher.shtml
- 95 http://www.drweb.de/php-scripting/php-styleswitcher.shtml
- 96 http://www.stichpunkt.de/css/switch.html
- 97 http://wordpress.org/extend/plugins/wp-style-switcher/
- 98 http://thecuriousfrog.com/projects/k2-style-switcher/
- 99 http://www.christianmontoya.com/2007/02/04/how-i-implemented-my-cookie-based-switcher/