Mutiny Design

Scripts

Scaleable HTML and CSS Guide, Part 1 - Introduction

Delicious Digg Furl Stumble Upon Technorati
Info Published: 23rd August 2007
Tags: HTML  CSS 

This post is part of a six part series (with possible satellites) on HTML that can increase in size infinitely in unison, allowing any content to be displayed perfectly when the font size is increased. To see an example of scalable HTML, pull the 'Pull Me' bar above or at SEM Labs. You can also increase the font size of a site (in Firefox, Safari and IE7) by pressing CTRL and +.

There are a number of people making vague references to scalable HTML in dark corners of the internet. Most often in reference to a very sloppy form of scalable HTML that you will often find on UK government sites that consists of increase and decrease font size buttons. Clicking these buttons will increase the size of the font on the site, but leave the HTML structure rigidly in place; transforming the website into some kind of MS Frontpage nightmare. Scalable HTML comes in the following flavours:

Sites That Scale Vertically - These sites' HTML structure will expand vertically to accommodate variable font sizes. They will not distort vertically or horizontally when the font size is increased, but eventually text will spill horizontally out of the HTML structure. This type of scalability is becoming increasingly popular with web 2.0 developers. You can see an example of this type of HTML at: FiftyFourEleven.

Sites That Scale Horizontally - I've never actually seen a site that scales in this manner due to the fact that most sites are designed in portrait, not landscape. They would function similar to vertical scalable sites, with the difference of scaling horizontally and the text spilling out vertically.

Scaleable Width - This type of HTML could be branded as fake scalability and are very rare. Scalable width sites allow the width of the content to expand without changing the font size.

Fully Scalable - I use the word 'fully' with some reserve, since in many cases 100% scalability is not possible due to browser constraints. Full scalability is when HTML can scale infinitely both vertically and horizontally to accommodate any font size. Other than sites I have made, the closest site I have seen to being fully scaleable is Yahoo.

Don Those Pixels

There are eight units of measurement that can be used when constructing sites with CSS; the most common being pixels (px). If you are going to make the switch from creating fixed HTML to scaleable HTML, you need to say goodbye to your beloved pixels and say hello to em, ex and %. Depending on which route you want to go down will determine which unit you will plump for. The em unit will probably be your best choice. 1em is simply equal to whatever the font size of the element in question is. So if you have a span element that has a font-size of 12px, 1em is equal to 12 pixels and 2em is equal to 24 pixels. The ex measurement unit is similar to em in that 1ex is equal to half of an element's font size. So if you have an address element with a font-size of 16px, 1ex is equal to 8px. The percentage unit is best used to compliment the use of the em element, since different resolutions will display the same percentage differently. Personally, I use em and % as a content splitter.

Don't worry if you are fond of your pixels, there still are still uses for the px unit in scalable HTML.

Browser Wars

All the major browsers have implemented support for scalability. Which browser has the best support for scalable HTML is debateable. In my opinion, Firefox, Safari and Konqueror are equally head and shoulders above the rest. However, none of them have perfect handling, which is down to the fact the W3C haven't quite finalised the blueprints for scalability. Support for scalability will be greatly enhanced by CSS 3.0.

Let's look at the major browsers and see how they handle scalability:

Internet Explorer

The most commonly used browser, Internet Explorer 6 - the bane of all good web developers - has support for scalability, although it can generally only be achieved though the use of JavaScript. It doesn't support floating pixels, which causes font incrementation to be jerky rather than smooth.

IE Buckling IE Faltering

Internet Explorer 6 buckeling under the strain of white space in a scaleable HTML layout.

Microsoft, being a bunch of nice guys had to go and ignore web standards again with the release of Internet Explorer 7 by totally disregarding the purpose of the different units of measurement in CSS. When you increase font size in Internet Explorer 7, regardless of the unit of measurements being used, IE will courteously increase all elements in an attempt to create a coherent web page. To be fair to the IE team, most web sites will scale better in IE 7 than in browsers that have good web standards support. But most web sites don't make any attempt to offer coherent scalability. So, when I actually want to use pixels in a layout I might as well not bother for the hordes using IE, because it won't work. The native scalability of IE7 is hindered by the fact that IE just resizes everything, including the body. This will cause your site to shift out of sight when increasing the font size, but can be combated with a CSS fix or ignored using JavaScript (more on this later). Another problem with IE resizing everything as it wishes, regardless of what CSS rules you have set is that background images are also scaled.

Firefox, Safari and Konqueror

Rather than covering these browsers individually, I will cover them together as their scalability support is virtually identical. All of these browsers follow web standards and scale elements according to their unit of measurement. So an element using the em unit will scale accordingly and an element with a fixed measurement will stay exactly how you want it. All browsers also support floating measurements (e.g. 12.1px), which means you can increase the size of your HTML in a smooth transition.

Opera

Like Internet Explorer, Opera takes things into their own hands and ignores the purpose of the different units of measurement. It doesn't support floating measurements and resizes background images.

Getting to know how each browser scales HTML is essential if you are to create cross-browser compatible scaleable HTML. However, Firefox, Safari and Konqueror are almost identical and IE and Opera are likewise, so it isn't too difficult.

How Long Does It Take?

An important question to ask in all aspects of web development is 'How long does it take?' For any seasoned CSS coder - whose sites almost work in IE6 first time - constructing scalable HTML should not take any more time that constructing fixed HTML. Once you have tried your hand a few times, you may even find that you can produce scalable HTML quicker than fixed HTML. Recently I constructed a scalable HTML site that had sixteen individual sub-pages designs that was compatible in IE6, IE7, Firefox, Opera and Safari in just over fifteen hours. To have constructed the same site in fixed HTML would have undoubtedly taken more time and resulted in bulkier CSS. If you are using XSLT to construct your site, scaleable HTML may very well speed up your markup turn around due to the fact that scaleable HTML is highly recyclable and uses the same HTML structure repeatedly.

So Why Should I Bother?

A lot of web developers don't see the point in creating scaleable HTML, but there are a number of advantages:

The Disadvantage

From my experience I would say the only disadvantage of scalable HTML is Internet Explorer, particularly IE6. If you start constructing scaleable HTML, you will run into a few new IE bugs and I bet you wouldn't be able to guess they all relate to floated elements, margin and white space. However, any able-handed CSS guru should be able to overcome these problems.

That's it for part one. Part two of this series will deal with creating the backbone of a scaleable website.

Comments

1. Tom Taylor Says:

27th August 2007

I think fully scalable websites are much more attractive than static width sites. Although there is obviously a different between fluid layout / 100% width sites and sites that grow in size. For example, if i'm viewing a website on my 1680x1050 monitor, and the website is a static 600 or 800 px wide, its not really taking advantage of all the available monitor space. This is why i promote flexibly fluid layouts. I also agree completely that the only way to go really is the 'em'. Using '%' as a guide, i find is just not good enough for cross browser compatibility, and the 'em' is much more similar across browsers.

2. David Says:

27th August 2007

Good point. I had not given to much thought to people who are using these big monitors. There isn't really any solutions to make a site look good on everything from 800x600 to 2560x1600. My main focus is for 1024*768 to 1440. If the site filling up the monitor is your goal, as you say, 100% width is the best option, but to make it really polished it will need some careful selection of element widths.

3. Bjorn Says:

30th October 2007

I love the comment in the ie6.css file for mutinydesign.co.uk, very amusing! I've always been interested in coding websites as neat as possible, but as of yet have never taken the plunge into creating fluidity. This guide has inspired me to change my design ethos. Currently toying with the idea of making a site to sell my services, but think I have a bit more learning to do! Anyway, thanks for the guide, it's been a good help.

4. David Hopkins Says:

4th November 2007

All in a days work, Bjorn. Good luck getting into web design, it is not an easy route.

5. David Ossorio Says:

12th November 2007

> Um, not sure how it works over there on the other side of the pond, but here in the USA we have this crazy thing called the First Amendment. Which, last time I checked, protects all sorts of unpopular speech. Like, say, websites that do not adhere to accessibility standards. So, even if the US government decided that a website was not sufficiently "accessible", they most certainly would NOT be able to make it a crime to publish it.

6. journalfortkj Says:

12th February 2008

rhonda britten vanessa anne hudgens biography condelisa rice chicken tetrazini ilearn.ucr.edu ashlie simpson litton loan servicing lp froguts lou gherigs disease barnies coffee amisha patel nude anna ammirati hatfields and mccoys bunnypoker.com ravishing rick rude freeonlinepics.de suzanne westenhoefer epodunk.com african chiclids gothicsluts walther g22 clips from caligula the movie missy misdemeanor elliot goku ss5 brad paisley whiskey lullaby netechangisme warroom.com joyoflinks agio patio furniture speigal ohlins shock vampiress costume acura csx thumbhole stocks sean yseult oriley auto parts rubatex delux checks cortisporin dan inosanto willys jeepster atroad timetokill carfacts emaxx blues clues handy dandy notebook sologig.com hunington bank bobby frasor naadac firstgov.com myspace codes-extended network banner aeroquip hose gsaauctions whipworms iasus throat mics louis vouitton juelzsantana 1130 wisn hemihypertrophy rubber stair treads mapblaster better business bereau cousin skeeter

7. northbeepp Says:

20th February 2008

[url=http://www.eda-solutions.com/de/assets/y/index.php]dem franchise boyz riding rims[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=1]hottyy[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=2]tentacle impregnation[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=3]tifa and yuffie lesbian[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=4]bruce levingston portraits[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=5]gold bezel belly[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=6]project entropia cheats[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=7]azmaria[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=8]file shareing[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=9]lactating milky wet nurse[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=10]congenital nevus treatment[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=11]angiolipomas[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=12]pear preserve recipe[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=13]yamaha ttr 50 pipe[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=14]260cc atv[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=15]2006 nfl mock drafts kansas city chiefs[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=16]jargons in real estate[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=17]paintless dent removal new jersey[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=18]by last supper tintoretto[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=19]georgetown invisalign[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=20]california mortgage refinancing home equity loan loands[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=21]montour spartans[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=22]tipos musica satanica[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=23]piloti spyder[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=24]knicker sniffing[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=25]mai haruna gallery[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=26]american tourister forrester[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=27]purextc main[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=28]sport927[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=29]bc250d scanner[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=30]vesna zmijanac mp3[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=31]natural remedies for feminine itching[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=32]maxprotect[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=33]mcveety[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=34]kesternich cabinet[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=35]sejarah portugis[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=36]desert cottontail rabbit[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=37]bob marley i shot the sherrif[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=38]monkys[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=39]jeniffer tilly[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=40]burnley nightlife[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=41]ascenders episode guide[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=42]mls solano county real estate[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=43]florencia caqueta[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=44]lenticular optical research and development[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=45]bluefield plastic surgery[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=46]pujols t-shirt[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=47]chain hang low by jibs[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=48]motoriduttori avvolgibili[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=49]kristine timkin[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=50]free blank venn diagram[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=51]brand new soco[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=52]yuki kajiura mp3[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=53]custom cornea long beach[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=54]nalgas de ninas[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=55]gayamore[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=56]income opporunity for nascar fans[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=57]cranberry gucci car interiors[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=58]m3788e[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=59]think a little different dean graziosi[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=60]scottsdale tile grout cleaning[/url] [url=http://www.eda-solutions.com/de/assets/y/?p=61]patricia heaton have breast implants[/url]

8. jhk Says:

21st March 2008

jk

Post A Comment