Showing posts with label web geekery. Show all posts
Showing posts with label web geekery. Show all posts

Sunday, February 21, 2010

Well, we didn't win an ONYA this year...

...but that doesn't mean we can't continue our great work and win one next year!

During his introductory comments at the ONYAs Che quoted someone-or-other who had said that you should never enter your work for an award because you'll get discouraged if you don't win, and you'll stop doing the good work you're already doing because you'll think it's not good enough. Che disagreed with this sentiment, and so do we.

At WebWeaver Productions we love doing what we do - we love designing and building beautiful accessible websites - and we know we're doing it pretty well - both because our clients love our work, and also because we were nominated four times in three categories for three different ONYAs.

Our Environmental Protection Authority website was nominated for Best Accessibility and Best Use of HTML/CSS, our Optimation website was also nominated for Best Use of HTML/CSS, and my website The Gathering archives was nominated for Best Content (Personal).

We were disappointed not to win - but completely honoured to be there in the first place, in such illustrious company.

Radio New Zealand won both the Best Accessibility category and the Best Use of HTML/CSS category - and it couldn't have gone to a nicer group of people. They've been under siege from National this week, and a huge cheer went up when they won their awards. It's great to see such a large organisation striving to keep their website as accessible as possible, creating the best quality code they can create, and working hard to maintain their high standards over time. Well done guys!

If you want to express your support for keeping Radio NZ commercial-free and out from under the thumb of political or commercial influence, you might like to join the Save Radio New Zealand Facebook group. As I write this I see it's almost at the 10,000 fans mark - not bad for a group that's only been in existence for four days. I think National might have a fight on their hands if they pursue this...

My dear friend Zef Fugaz ended up winning the Best Content (Personal) category for his fantastic blog, zef[a]media - which he's been writing for years and years. It's completely brilliant - and shows very clearly just why he's one of New Zealand's most experienced and most well-respected user experience web professionals. Great job, Zef!

Being nominated for an ONYA (or four!) is especially thrilling because the judges are pretty much like superstars in our universe. It's rather awesome knowing that Alex Wright (New York Times), Amy Hoy (Slash7), Bek Hodgson (Etsy), Brian Fling (pinch/zoom), Donna Spencer (Maadmob), Jason Ryan (State Services Commission), Rachel McAlpine (Contented Enterprises), Russ Weakley (Max Design), and Thomas Fuchs (script.aculo.us) might have taken a look at our work...

It inspires all of us to keep working, keep learning, keep on striving for perfection, and keep on doing the best job we can possibly do. Our websites are made with love, just as Webstock and the ONYAs are made with love.



projection mapping + visuals: thedarkroom.tv audio + sound design: jeramiah ross aka module wellington town hall new zealand / 19.02.10 (larger version here)

Thank you everyone involved in both Webstock and the ONYAs for an absolutely wonderful week. You really do rock! WE LOVE YOU!


Technorati tags: , , , , , , , , , , , , , , , , , , , , , , , .

Read the full post

Saturday, February 13, 2010

Reason #567 why I love Webstock - attention to detail

So there I was, thinking about what to wear for the ONYAs - and wondering where the heck I was going to stash my ONYAs clothes during the conference on Friday.

Should I wear my ONYAs outfit all day? Not such a great idea - it'll get all creased and diminish the fun of dressing up for dinner.

Should I plan to go home in between and get changed? Not enough time really.

Am I going to have to lug it around in my bag all day? Bad idea - it'll be a pain to have to carry it around and it'll get all mashed up in my bag.

Or should I ask the lovely dudes at Shift if I could stash it there and hope they haven't all gone home by the time I want to retrieve it? OK as long as they don't all go home early that day, leaving my clothes behind locked doors and me with nothing special to wear.

Turns out the Webstock crew really have thought of everything. In addition to blogging about what geek designer formal actually means, they've very kindly arranged a place where we can store our outfits during the day, and changing rooms for us to use between the time Webstock ends and the ONYAs start.

I love a team that pays attention to the details! Thanks, Webstock crew! You rock!

Technorati tags: , , , , , .

Read the full post

Monday, January 25, 2010

IE8 bugs in Windows 7 but not in Windows XP?

In the space of the last two days we've come across two completely different IE8 bugs (one in a Facebook app and the other on a new website) that occur in Windows 7 - but that are not happening in IE8 on a Windows XP machine.

Oh my lawd. Not only do we have to continue bug-fixing in IE6 and IE7 (when will that ever end?), but now we're seeing IE8 bugs that didn't exist in XP, but are showing up in the supposedly newer and better Windows 7. Microsoft really are deeply, deeply crap, aren't they?

I was able to fix the Facebook app bug (sight unseen because I don't have a Win7 machine) by applying the same bug fix to IE8 that I used on IE6 and IE7. In this instance it was a HasLayout issue, which is normally fixed with zoom:1 - and which I fixed with the old Holly Hack in Facebook cos Facebook returns errors for zoom.

Anyway, in this case a) the fix for IE6/7 worked for IE8 and b) it was the kind of fix that you can include for IE8 in Win7 that won't break IE8 where it's not needed in WinXP.

But what if I'd needed a fix for, say, the duplicate characters bug that requires a negative margin of -3px on the opposite margin to the direction of the float? If you include it in a compliant browser like FireFox it can break the layout in some situations, which is one reason why we put IE fixes in conditional stylesheets. But how do you include a conditional stylesheet for IE8 in Win7 without also including it for IE8 in WinXP? As far as I know that's not possible. I smell trouble!

The second instance of the Win7-bug occurred in a website we're building that has a bunch of jQuery in it for sliding images. At the moment I have absolutely no clue why it's happening, nor can I see it because it's not happening in WinXP. My first approach will be to see if I have any fixes already in place for IE6 or IE7, and add them to the conditional stylesheet for IE8. Maybe that'll work. I just hope it doesn't break IE8 in WinXP, assuming it works at all.

Has anyone else come across this IE8/Win7 issue?


Technorati tags: , , , , , , , , , , , , , , .

Read the full post

Saturday, January 09, 2010

A CSS/jQuery solution for creating multi-column lists

I seem to have found a solution for one of those front-end developer "Holy Grail" challenges - getting an unordered list to rearrange itself into two (or more) columns if the content of the first column gets too long.

Before I explain how to do it, I should point out that the vast majority of this solution is already out there in the form of a neat jQuery plugin called Columnizer jQuery written by Adam Wulf. I had nothing to do with the creation of it - I just stumbled upon it when I was googling for a solution, and wondered if I could adapt it for my particular layout problem. I added a bit of additional jQuery so it would do exactly what I wanted, and to my complete astonishment - it worked. Amazing!

There are a bunch of CSS-only solutions for multi-column lists which kinda sorta work - as long as you have a static list and can attach classes to various individual <li> tags. They generally work on the principle of moving some of the list items to a different position on the page using CSS - so that the list remains intact within the HTML, but appears to be broken up into multiple columns when viewed in your browser.

The CSS Swag: Multi-Column Lists article at A List Apart is one of the best examples of this, and in fact shows a whole bunch of different ways of achieving this goal.

However (and it's a big "however") - none of these solutions will work with a dynamically-generated list where you don't know from page to page how many items will be in that list, and where you can't add your own individual classes or IDs to each <li> in advance.

A perfect example of this situation - and the one I was wrestling with - is when you're building a set of templates which will be integrated into a CMS, and the unordered list in question is the subnav - which has to fit into a fixed-height space.

Here's what the subnav in my design normally looks like:

Single-column subnav list.
But... I do not know how many pages the client will end up creating within each subsection of their new website. What I do know is that the number of list items in each subnav menu will vary from section to section, and will be generated automatically by the CMS (which means I can't add classes or IDs).

So this is what I want it to do when the number of items in the list gets too long for the fixed-height space to contain them all:

2-column subnav list.
One thing to note: you need to be sure that your client isn't going to use massively long names for their pages, as these will generally translate into massively long links in the subnav, in which case you will soon run out of room - especially in the 2-column layout. You can pre-empt this by training them to use short page names and/or re-name them for the subnav. Most CMSs will let you do this - Silverstripe, for example, which is what we're using for this site - has an additional field in each page where you can define the text you want to be used as the subnav link. Very sensible.

Adam Wulf's plugin is designed to automatically lay out your content in newspaper column format. You can specify either column width and/or height or a static number of columns. I noticed that one of the lines of code in his jQuery was

$('li').addClass("dontsplit");
...which made me think he might have included something to ensure that lists which get split into two different columns still work properly - and he has! Clever man. We're 90% of the way there already!

I have nowhere near the technical expertise required to write my own jQuery plugins - or even to understand all the code within a plugin - but I do have enough of an understanding of jQuery to be able to utilise what others have created and adapt it to my own requirements - sometimes.

I'm not even going to try and explain how Adam's plugin works - because I don't actually know - I'm simply going to highlight the bits you need to make this list do its thing, and then show you the bit of jQuery I added which makes the list do one thing when it's short - and another when it's long.

Here's how I did it...

I began with Adam's Sample 5 page. He describes this example as one that:
Shows fixed width and height columns scrolling horizontally
...which seemed to be what I was looking for.

I viewed the source of his example page and created a copy for myself - test-columnizer. Then I replaced his example text with a simple unordered list, exactly like the subnav code I'm going to be using. You can see my test example here - test-columnizer2. Because his columns were initially set to be 400px high I put a whole bunch of list items in my test list to make sure it was working properly.

In the jQuery function I removed
$('h1').addClass('dontend');
because I didn't need it, and replaced it with
$('li').addClass("dontsplit");
The class "dontsplit" is built into the plugin and prevents individual list items from being split into two columns. The jQuery now looks like this:
$(function(){
$('li').addClass("dontsplit");
$('.wide').columnize({
width : 300,
height : 400
});
});
I also removed the <div class="thin"> </div> in the HTML (you can see it towards the end of the page in test-columnizer) because, again, I don't need it. This "thin" div in the plugin can be set to contain any overflow from columns created within the "wide" div - you can see an example on Adam's website - Sample 4 page. Because I don't intend to have any overflow in this design, it can come out.

The next step was to style the list so that it looked more like my design, and to place it inside my subnav div, which is a fixed width, fixed height container. You can see an example here - test-columnizer3.

I altered the jQuery to this:
$(function(){
$('li').addClass("dontsplit");
$('.wide').columnize({
width : 90,
height : 150
});
});
...which tells the plugin to make each column 90px wide by 150px high.

In addition to my specific CSS styling for the subnav box and the list items, you'll also notice I made a couple of changes to Adam's existing CSS styling. I set a specific width on .wide, like this:
.wide { 
clear: both;
width: 190px !important;
}
Without this width setting, the total width of .wide is calculated by the plugin, and ends up as 180px (2 columns at 90px each = 180px). I wanted a gutter of 10px between the two columns, which meant that the .wide div needed to be 190px wide in total. By adding !important to the style in the CSS I can force it to override the plugin's calculated width.

Adam has very helpfully coded the plugin to add a class of "last" to the last column in the div, which meant I could then add this style to my CSS:
#subnav .wide .last {
float: right !important;
}
...to force the last column to float right - so creating that gutter of 10px between the first (left-hand) column and the last (right-hand) column. Again, by adding !important I can force it to override the plugin's default float: left.

Here's the example page again - test-columnizer3 - in case you missed the link earlier.

OK - so now let's look at what the subnav does if the number of items in the list is quite small - test-columnizer4.

Hmmm. That's not exactly what I want. If there are just a few list items, and we don't actually need two columns to fit them all in, I want a single column that stretches right across the subnav space - like this:

Single-column subnav list.
...not like this:

Doh! Single-narrow-column subnav list.

In other words I need an if... statement in the jQuery that will trigger the columnize plugin only when the number of list items exceeds the space available in the first column.

Firstly I defined a variable maxHeight of 150px, and then created my if... statement which basically says "if the height of the .wide div is greater than 150px, then run the jQuery plugin." The whole thing looks like this:
var maxHeight = 150;

$(function(){
if ($('.wide').height() > maxHeight)
$('.wide').columnize({
width : 90,
height : 150
});
});
I decided to set my variable as a maximum height rather than by counting the actual number of items and setting a maximum number of items in each column because a) individual list items might sometimes wrap onto more than one line - which would mess up the calculation and b) if you're viewing the website in an older browser like IE6 or IE7 and you've increased the font size, it will again mess up the calculation (although I guess I could have overcome that issue by using ems).

You can see an example of the completed solution here: test-columnizer5.

And here's the same solution with a few more items in the list to show how it rearranges itself into 2 columns when necessary: test-columnizer6.

Perfect! Now the subnav list spreads nicely across the whole div, unless there are too many list items to fit into the fixed-height space, in which case it splits into two separate lists in two columns, with each column only half the width of the original single column.

I've tested the solution in IE6, IE7, IE8, Firefox, Opera and Safari on both PC and Mac where appropriate, and it works just fine. Incredible.

Thanks a million to Adam Wulf for coming up with an awesome plugin that allowed me to do exactly what I wanted with just a little tweak at the very end. It's a great piece of work!

I hope that by blogging about it I'll flag it as a solution for the multi-column list problem, which will make it easier to find for those googling for a fix. Let me know if it works for you.


Technorati tags: , , , , , , , , , , , , , , , , , .

Read the full post

Sunday, December 06, 2009

The Gathering archives website - and the ONYAs

The ONYAs finalist. WOOHOO!

The Gathering archives website is a finalist in the Best content (personal) category of the ONYAs!

Crikey!

I'm completely thrilled. It took me a year of working on the site to get it to a state where I was ready to put it online, and it's grown quite a lot since then.

The ONYA judge's comment about the site cracked me up. It's so funny, and also so true...

A multi-media mashup of memoir, fractured histories and anecdotes from a series of events that erased the memories of many that were there. Alison's site is a public service...

The Gathering archives website. New Year 2006/07 marked the 10th anniversary of the first Gathering dance party on top of Takaka Hill near Nelson. The last Gathering was held over New Year 2001/02, and as I had been involved in the organisation of four out of the six Gatherings, and had created the original Gathering website, I felt sad that there was virtually nothing remaining online about these iconic events.

In October 2006 I set about creating, designing, building and writing the Gathering archives website, with the aim of becoming the authoritative source of information on the history and background of The Gathering. The site is divided into different sections for each of the six Gatherings, and includes facts & figures, media coverage, Gathering artwork, photos, video and film footage, Gatherer stories and maps of the venue for each party.

It will always be a work in progress, because each party was so vast and complex that it would be impossible for one person to have a complete overview of what went on at even a single event, let alone six. Although I had a whole lot of "official" archival material (including media coverage, Gathering artwork etc), I wanted the site to be much more than that. I wanted it to reflect the memories and stories of the many thousands of Gatherers who took part each year, as well as the hundreds of crew members and organisations who supported us in putting on New Zealand's best-loved dance parties.

I haven't had much time this year to add new stuff to the site, but I've already spent time improving the usability of the homepage as a result of my ONYAs nomination (see what a bit of good news does to kick-start me into action once more!), and I plan to do quite a bit more on the site before February when the winners in each category are announced.

The other two finalists in this category are Jared Gulian for Moon over Martinborough and my dear friend Zef Fugaz for zef[a]media. Those of you who know your Gathering history might remember Zef - he was our very awesome assistant producer/BetaSP-Cam/graphics guru for The Gathering documentary 97/98.

The ONYAs celebrate those who design, develop and create New Zealand's best websites and applications. They’re awards by the industry, for the industry.

It's a real honour to be nominated for the award, and to be a finalist in such esteemed company. Good luck guys, and may the best website win!

Technorati tags: , , , , , , , , , , , , , , , , , , .

Read the full post

Thursday, December 03, 2009

Thrilled to bits with the ONYAs

The Onyas - finalist.
A year ago things looked pretty bleak job-wise. Sue and I had just been made redundant from our dream web design company, together with Rosie and Rene from the Welli office and four others from the Auckland office.

My first thought when I heard we were losing our jobs was that I would lose my house because I wouldn't be able to pay the mortgage. My second thought was that maybe I wasn't good enough and that that's why I had been one of the ones selected to go.

It was a pretty rough end to the year, to say the least.

However, you have to play with the cards you're dealt, so after a few days feeling sorry for myself I picked myself up and started looking for work.

I've been doing contract and freelance work as WebWeaver Productions for about 13 years now, off and on, so that's what I went back to. Tom and I had done a few little WebWeaver projects for various clients since we met at Shift and I love working with him, so I had my programmer already in place, and we invited Sue to work with us on projects where we needed another designer.

We've done a mixture of freelance work as WebWeaver and contract work for various web design companies over the past 12 months. Here's (some of) what we've achieved this year:

Oh - and...
  • Created a baby - a Sue&Jon project - design by Sue, development by Sue, integration by Jon - congratulations you guys!

It's been a great year!

I think one of the best things about being a freelancer is the immediacy - and the range - of the work you do. When we create a website as WebWeaver Productions, we know we've personally won the right to work on that project, because we've pitched for the job, written the quote, done the IA, liaised with the client, managed the project, designed the website, built the HTML and CSS, integrated the site, and tested (and sometimes even content-loaded) it.

No-one else won that work and then employed us to do the design, build or integration - we won it, and we worked on it in its entirety from start to finish. It's a great feeling. When the client likes our work they tell us directly - and if they really like our work they tell other people and we get to do it all over again. It's awesome.

So you might have noticed that in recognition of all that beavering away we've done this year we decided to enter a couple of WebWeaver Productions websites for the inaugural ONYAs web awards...

Yesterday they announced the Best Accessibility category -- and there was our website for the Environmental Protection Authority of New Zealand - we're one of the three finalists, together with Radio New Zealand (for the Radio New Zealand site) and Springload (for the New Zealand Rehabilitation Association website). Crikey! How completely cool is that?

We knew the EPA site stood a good chance - it's completely accessible and passes all the WCAG 2.0 accessibility requirements - and needless to say we're completely thrilled to be selected as a finalist, especially as we're up there with such very excellent company. Gosh.

This is a seriously big deal for us. We're such a tiny little company - in fact we're not exactly a company at all - we like to describe ourselves as "an informal co-operative".

We all work together on projects when there's a need for us to each have a role (for example on the Optimation website), and sometimes it's just me and Sue, (for example on the EPA website), or just me and Tom (for example on the Plumbers website), and sometimes it's just me (for example, a website I'm currently completing for a government agency I've worked with in the past). It depends - and so far this year we've all been able to dovetail our various WebWeaver roles very neatly with design agency contract work (me and Tom) and producing babies (Sue!).

For the ONYAs we're potentially up against every one of the big NZ web design companies (assuming that they entered), and so to get nominated as a finalist in one of the categories we've entered is EXTREMELY exciting, and very gratifying. We absolutely LOVE what we do, so to get acknowledgement from the industry itself that we're doing good work is satisfying to say the least (and that may well be the understatement of the year!).

But wait - there's more.

We knew they'd be starting to announce the finalists in each category on Monday, so when we heard about the Best Accessibility category on Wednesday I was still rather butterfly-tummied from the anticipation I'd been building up all week. Today I was somewhat more blasé. I'd sort of gotten over the excitement a bit - and I almost didn't spot the second email that came through from Mike this afternoon...

I read it and virtually fell off my chair in shock.



Oh



My



God!


The three finalists for the Best use of HTML and CSS category were announced today - and WebWeaver Productions has not one but TWO websites in the top three!!!

Our website for the Environmental Protection Authority of New Zealand is once again a finalist, as is our website for Optimation. We're up against the Radio New Zealand website in this category as well.

How can I explain how much this means to me?

I love my job. I ADORE my job. I love designing and building websites just as much (if not more) today, as I did 13 years ago when I first started out. It's the best job in the world, and I feel so lucky to have found it.

I'm also a perfectionist, and very single-minded when it comes to doing stuff. I want to be the best I can possibly be, and I want the work I produce to be as near-perfect as I can possibly make it. I know that HTML/CSS is my core skill, and dammit I wanted to see how my work compared to the work of my peers. I thought I was pretty good, but I didn't know for sure. I really really wanted to see one of my websites up there as a finalist in this category. I mean I REALLY wanted it.

And I got two. I still can't quite believe it.

I keep on wanting to run round and round yelling "I did it! We did it! We rock! EEEEEEEE!!!"

Actually I did do a bit of that this afternoon at Optimation. It was fun!

It's funny how things come full circle, isn't it? There we were a year ago wondering what we'd done wrong, and trying not to take the redundancies personally, and yet still feeling like we mustn't have been good enough to keep - and now here we are as finalists for the ONYAs. It's bloody awesome actually.

And the coolest thing? Our dream web design company, Shift, is the major sponsor. Thank you Shift, thank you Mike and Tash and the rest of the Webstock crew - you rock!

As I said earlier, it's been a great year.


Technorati tags: , , , , , , , , , , , , , .

Read the full post

Sunday, November 22, 2009

Working with the Ministry

Ministry for the Environment homepage screenshot. Earlier on in the year we were given the opportunity to pitch for a re-design job on the Ministry for the Environment's website, which we won. Sue and I were completely thrilled - it's the first Government client that WebWeaver Productions has pitched for (although I've worked on over 50 government websites as a contractor and/or employee), so to win it was pretty darned cool.

Our primary contact was Dee Guja, the Ministry's senior adviser, Stakeholder Engagement/Publications, and we worked on the project with the Ministry's webmaster, Jennifer Geard. Both Dee and Jennifer are very good at their jobs, and as a result the Ministry has become one of our favourite clients - they absolutely rock!

The brief was tricky, to say the least. The Ministry's website is huge - somewhere around 13,000 pages - and the old site was based on a set of Dreamweaver templates which were pretty old and had a bunch of table-based layouts to contend with. Over the years many different MfE employees have added content to the Ministry site, and in some cases the code used to display the same 'look' has been achieved using a variety of techniques - some of which are now out of date and no longer validate.

Our job was to design and build a new set of e-government compliant best-practice Dreamweaver templates which would seamlessly replace the old ones, together with a stylesheet that would not only control the new template HTML, but would restyle all of the old legacy code within the subnav, main content area and feature column so that it would display properly in the design without the Ministry web team having to rewrite the HTML.

Oh - and it needed to be sufficiently robust and all-encompassing so that Jennifer and her team could be confident that all 13,000 pages would display as expected - without having to check every page before go-live.

Sue worked her magic and produced a beautiful new design which was light years away from the old design. I built a set of 11 HTML/CSS templates which I then converted to Dreamweaver templates, matching the editable regions as closely as possible to their existing ones so that when Jennifer came to do the global 'find and replace' that would replace their old templates with our new ones, the site would hold together.

Our test list consisted of 16 different browser/OS combinations (the number has been somewhat reduced since then), which meant I had to get on TradeMe and buy a bunch of old PCs so that I could get the full range of PC operating systems I needed for testing. The completely awesome standalone versions of IE6 and IE7 no longer work properly when you've got IE8 installed, so I needed separate versions of the same OS in order to test all three versions of IE. Oh joy.

The project began back in April, and the site went live in June, which is not bad going for such a large website. Jennifer and her team are working through the site to remove the worst (legacy) examples of non-compliant code, and the new templates were tested for e-govt compliance by Bruce Aylward of W 3 A. He's an expert on website accessibility, and taught me a bunch of new tricks, which I really appreciated.

All in all a great project to be involved with, and a very satisfactory result. We hope you like the Ministry's new website as much as we do.

Technorati tags: , , , , , , , , , , , , , , , , .

Read the full post

Monday, November 09, 2009

Entering the ONYAs

ONYAs logoI've spent the weekend completing multiple entries for the inaugural ONYAs web awards, which are being organised by the very wonderful Mike and Tash who also bring you the equally wonderful Webstock.

The closing date was today - originally 6pm this evening, but they've extended it until midnight. You have less than an hour, folks!

Actually, having said that, you might have some trouble making a submission between now and midnight - the site's down. Wonder if we knocked it out with the sheer volume of last-minute entries?

WebWeaver Productions have entered two of our most recent sites - the Environmental Protection Authority website that went live on October 1, and the Optimation website that went live just a few hours ago.

We're very proud of both sites - we think they represent some of WebWeaver's best work this year - and we think we've got as good a chance as anyone of winning an (already coveted) award.

We've entered the EPA site for Best use of HTML & CSS and Best accessibility (both in my name), and the Optimation site for Best use of HTML & CSS (me) and Best visual design (Sue). I think Amanda might also be entering the Opti site for Best content (corporate) because the writing she's done for the new site is really good.

We were only sad that there wasn't a category for Best integration into a CMS, because poor old Tom's the only WebWeaver(er) who doesn't have a category to enter. No fair! I think we would definitely have entered the Opti site for that category too if there had been one.

Oh - and I also entered The Gathering archives in the Best content (personal) category - just because I can. And also 'cos I think it's a pretty cool site.

Now all we have to do is keep all our fingers and toes crossed until February 19. Crikey!

Technorati tags: , , , , , , , , , , , , , , , , , , ,

Read the full post

Thursday, October 01, 2009

A quick fix for the 1px rounding error

[Here's the quick solution if you can't be bothered to read this whole post: stick a border on the div that's causing the 1px rounding error].

Now let me elaborate, because there's actually a bit more to it than that...

We (like many other web design companies) generally design our websites as fixed-width, centered in the browser window, and optimised to 1024px wide with no horizontal scrolling at 1024. When you take the vertical scrollbar into account that means the maximum width for the outer container div is 1004px.

Sue likes to design websites with quite substantial dropshadows on either side of the outer container, which makes the whole graphic wider than 1004px. No problem - I just create the dropshadow as a single graphic which I style as a background image on the body tag in the CSS, centered in the browser window by setting the width of the graphic to 50% - like this:

body {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 62.5%;
text-align: center;
margin: 0;
padding: 0;
color: #595959;
background: #009ec7 url(../img/bg-page.jpg) no-repeat 50% 0;
}

#container {
width: 960px;
margin: 0 auto 0 auto;
padding: 0 0 10px 0;
text-align: left;
background-color: #fff;
}

The example above is for a site where the shadow starts off fairly narrow at the top, gets a lot fatter for a couple of hundred pixels, then gradually gets narrower again until it disappears altogether. It makes the page look like it's rising off the background for a while near the top of the browser window.

Here's the shadow graphic (click to enlarge):



With a design where the shadow is a consistent width all the way down the page, you would take a narrow strip of shadow and save that as a vertically-tiled background image instead - and the CSS would look like this:

background: #009ec7 url(../img/bg-page.jpg) repeat-y 50% 0;

The problem with this solution (whether you use a single or a tiled background image) is the mixing of the fixed-width #container div together with a percentage-positioned background graphic. Exact pixel widths don't play well with percentages in CSS, and the combination of the two is likely to create a 1px rounding error in many situations. It's why we generally stick to one or the other and don't use both together unless we absolutely have to.

In my example, this is what you get when you view the site in Opera or Safari on my Mac (click to enlarge image).

This is a screenshot of the right-hand side of the page within the browser window. You can clearly see a 1px-wide white "border" to the right of the light blue header, and you can also see a distinct "step" further down the page, which marks the bottom of the dropshadow background image on the body tag.

Interestingly enough, the 1px rounding error on this site only showed up in Safari on my Mac and Opera on Mac and PC. Firefox was fine (of course) and amazingly enough, IE6 and IE7 on my test PC also handled it just fine - not a rounding error in sight!

But that's not good enough. My sites get tested in IE6, IE7, IE8, Firefox, Opera and Safari (at a minimum), and if it's not perfect in all browsers on all platforms I'm going to do my damnedest to try and fix it.

The 1px rounding error is one of the few bugs that gurus such as Holly and Big John at Position is Everything have reluctantly assigned to the "annoying bugs that can't be fixed" basket, but because I initially didn't recognise my bug as a 1px rounding error, I tried to fix it myself.

...and found a workaround for this particular example that works pretty well...

It took me ages to figure out that the "step" was actually the bottom of the background graphic in the body tag. It didn't seem to match up with any of my divs on the actual page when I tested it with Firebug, and for a while there I was completely stumped. What's causing this step???? Arrrrgggghhhh.

I tried a bunch of things to get rid of that nasty little white line to the right of the light blue header. Maybe the white is showing through from the white background on the #container div that's wrapped around the header div? Could I add a light blue background to the top of #container so the line is light blue (matching the header) instead of white? Nope. Doesn't work. And even if I had been able to fix the header issue using that kind of solution, the step would still have been visible lower down the page.

Think again.

The fact that the white line appeared to be behaving more like a 1px-wide border than a background showing through a 1px-wide gap (because I couldn't fix it by adding a coloured background to #container) made me wonder what would happen if I tried adding a border of my own to #container instead.

Here's my first test - a variation on the classic "border: 1px solid red" that I use whenever I'm bug-fixing to identify the div I'm working on (click image to enlarge).

This example uses "border-right: 1px solid red;" on the #container div.

Awesome! The step is gone! How crazy is that?

Now we have a consistent red border all the way down the right-hand side of the #container div, instead of the bug-created white border-like line that only goes down as far as the bottom of the page background graphic.

From this point, it's easy to see how to make the border almost disappear - to a point where I can live with it as a "quick fix", anyway...

By selecting the hex value of the light blue header background at its farthest-right point (which in this case is #b2e2ee) and applying it to #container div instead of the red border, like this:

#container {
width: 960px;
margin: 0 auto 0 auto;
padding: 0 0 10px 0;
text-align: left;
background-color: #fff;
border-right: 1px solid #b2e2ee; /* fix for 1px rounding error bug */
}

...I get this result (click image to enlarge).

Now the right border blends seamlessly into the light blue header to its left at the top of the page, and further down the page it blends nicely into the darker blue page background to its right.

It's a bit of an optical illusion, because if you look very very closely where the light blue header meets the white content area of the page, you can see the light blue bleeding into the white, but hey - I can live with that. It's much better than a white border and a white step, anyway.

Wait, I can't live with it! That bit of bleeding blue's annoying me. Yes I know I've already delivered this particular website to the client, but I can always get them to tweak the stylesheet for me...

Here's an even better colour choice for the border:

Grab a representative darker shade of blue page background from your photoshop file. I've used #00a1ce. Use that instead. This what you get (click image to enlarge).

OK, this optical illusion is better than the last one. No bleeding blue, because we're not using a colour that appears in part of the actual page (the light blue) and then stops (where the white content area begins).

By choosing a colour that matches the page background, rather than part of the page itself, the border blends outwards rather than inwards, and the edge of the page appears to be completely uniform. If you have a shaded background like in this design, just pick any pixel from close-in to where the background meets the page, and you should be fine with whatever shade of blue you end up with. It's an optical illusion, after all.

To achieve the neatest possible result, it's probably a good idea to replicate your border on both sides of the #container div:

#container {
width: 960px;
margin: 0 auto 0 auto;
padding: 0 0 10px 0;
text-align: left;
background-color: #fff;
border-right: 1px solid #00a1ce; /* fix for 1px rounding error bug */
border-left: 1px solid #00a1ce; /* fix for 1px rounding error bug */
}

In Sue's design for this particular site, the header starts off white on the far left-hand side and gradually shades to light blue as you move right. My original light-blue border fix wouldn't work on the left of the container, as it contrasted with the white header on that side, but having the blue match the darker blue page background works fine, because the background is consistent on both sides.

This solution can also be adapted for a design where the background color changes dramatically as you progess down the page. A background colour that fades vertically into white or another colour entirely, for example. Or a drop shadow at the top of a white background that fades away as you scroll down the page until it eventually disappears into the white.

All you need to do is experiment with the colour of the border until you find one that both you and the designer can live with. It might be white, giving you a 1px white frame on both sides of the page, between the container and the dropshadow. It could be a shade of grey, as long as your designer can live with their fading dropshadow eventually becoming a 1px grey border instead of disappearing completely into white. Whatever works for your particular design.

Yes, I know this means you may have to go back and get the designer to tweak their design because you can't make it work (which is pretty much always a no-no as far as I'm concerned), but we are dealing with the dreaded 1px rounding error here, and even Holly 'n' John haven't found a complete fix for it...

Yes, it's a workaround rather than a complete fix - in that it doesn't remove the 1px line, it simply overwrites it and then disguises it - but I reckon it's a good solution to the particular visual problem we had in our design - and one which I think might be useful to other designers and developers out there.

It even provides a fix for Big John's Rounding error test page, without breaking the layout - even in IE6 - which is rather amusing, because if anything's guaranteed to break an IE6 layout it's adding a border to a percentage div where all your combined percentages already add up to 100%...

Change John's style from

#wrapper div {
position: absolute;
background: black;
width: 20%;
height: 20%;
}

to

#wrapper div {
position: absolute;
background: black;
width: 20%;
height: 20%;
border-right: 1px solid black;
border-bottom: 1px solid black;
}

...and you'll see what I mean.

The reason why the 1px border fix doesn't break John's example layout, even in IE6, is because the divs have space in which to spread out - they're free to sit nicely next to each other because they're absolutely positioned which takes them out of the flow - rather than being floated. In John's example, if I float the divs by changing his styling to:

#wrapper div {
float: left;
background: black;
width: 20%;
height: 20%;
border-right: 1px solid red;
border-bottom: 1px solid red;
}

...the placement of the divs breaks and the last div ends up in a new row (I've coloured the borders red so you can see 'em - click image to enlarge). This is because the addition of the 1px right borders means that the total width of all the divs in a row is now more than 100% - and with floated divs this matters. It breaks in all browsers, including compliant ones like Firefox.

John's original example (without my borders) also breaks in IE6 and IE7 if you float the divs instead of absolutely positioning them (although it looks fine in Firefox). This is because the 1px rounding error also adds additional width to the divs, making them too wide for their container. In the case of IE6 and I7 this results in a horrible break/not break bounce to the page as you slowly increase or decrease the browser window width and as the rounding error comes and goes. This is presumably why he decided to build his example as a series of absolutely positioned divs instead of floated ones :)

The reason why my 1px border solution doesn't break our website in IE6 and IE7 is because of the way in which the website is built. The #container div is the outermost div on my page, and although it isn't absolutely positioned (or floated, for that matter) there are no other divs wrapped around it to constrain its size in any way. This means that adding a 1px border on either side (so increasing its overall width by 2px) isn't going to break anything by making it too wide. It just spreads out a bit, ending up 2px wider than the original page design.

The only time this would be an issue is if your design is already 1004px wide, which is the maximum it can be to avoid a horizontal scrollbar at 1024 on pages that have a vertical scrollbar. In this instance you would have to decrease your page width by 2px in order to stay within the maximum once you add the 1px border on either side.

So - to summarise:

If your div structure will allow you to do this without breaking it, a fix for the 1px rounding error is to add a 1px right border to the div where the rounding error is occurring, and colour it to match whatever colour you've got wrapping around that div. The border will overwrite the rounding error and the colour will camouflage it to match its wrapper so that it becomes virtually invisible.

By careful selection of your border colour, and by tweaking any wrapper div widths to allow for the width of the border without breaking the layout, this solution will work with a range of layouts, providing you with a controllable border instead of an uncontrollable 1px error which, in older browsers like IE6 and IE7, comes and goes as you increase and decrease the browser window width.

I was pretty thrilled to stumble upon this solution, and I hope it's of use to someone out there. I know it's not the perfect answer in all situations, but hopefully it's flexible enough to help in a variety of layouts - and in a wide range of browsers. It works in IE6, IE7, IE8, Firefox, Safari and Opera. I haven't tested it in earlier IEs or any other browsers - let me know what happens if you do.

Let me know how you get on!


Technorati tags: , , , , , , , , , , , , , , , , , , , , .

Read the full post

Monday, July 13, 2009

Why so quiet on the blog front, WebWeaver?

I'll probably jinx it by writing this, but the reason why I haven't been blogging much lately is because we (WebWeaver Productions) have been very very busy. Recession? What recession? (Ha! Now I've really gone and done it!)

In fact, we're so busy right now that I've actually stopped taking on new work until September at the earliest - and depending on a couple of proposals we're currently waiting on, it may end up being October before we can take on anything new. Crikey!

I never in my wildest dreams imagined we'd be doing this well. Which is why I keep on looking over my shoulder waiting for all the work to suddenly dry up. But so far, it hasn't. Hooray!

I really miss my blog, but I'm so busy right this minute that I'm working during the day and in the evenings as well in order to keep up with everything. That's not normally how I like to work - I think it's really important not to take on too much at any one time - but sometimes it can't be avoided.

Projects do run over sometimes - external forces being what they are - and occasionally projects come up unexpectedly that you really have to do straight away, and I like to be able to accommodate clients if I possibly can. It's only for a couple more days anyway, and then I can get back to concentrating on one thing at a time, which is how I prefer it.

A few people have suggested that, seeing as we're so busy, rather than turning down work we should take on a few more people and expand the business.

I've thought about it, and decided not to.

I'm an information architect, designer, developer, Flash animator and writer. I'm also the project manager and client liaison person for all our projects, and right this minute I think I have the balance just about right.

That is to say, if I took on more people it would end up with me doing more admin and project management, and less design and development - which would sadden me, because that's where my passion truly lies. I'd hate to be giving away HTML/CSS work to someone else to have fun with while I got stuck with all the writing of proposals and stuff!

Plus I'm just a tiny bit of a control freak (and that's just a tiny bit of an understatement), which means that I do actually like doing the proposals and the project management and client liaison for our projects - so I wouldn't really want to give that away either.

We're doing OK right now, and I have no wish to be Master of the Universe, and no plans to create a WebWeaver Productions empire. I like us just the way we are.

It's interesting that every project I've worked on this year has come through my networks, my contacts, and friends-of-friends. We still haven't had to respond to a single cold call for submissions in order to find enough work to do.

I'm fully expecting my list of people who know people to eventually run out - at some point surely we'll have built beautiful websites for everyone - but right now there are no signs that this is happening - in fact it seems to be getting even busier. Crazy! But in a good way.

My strike rate is pretty high in terms of winning jobs with the proposals I write. I'm not sure what a good success rate would be for the average web design company, but I reckon mine is somewhere over 75%, which seems pretty good to me.

I'm not entirely sure what our magic ingredient is - whether it's the way I write, or our winning personalities (!), or maybe it simply boils down to cost in the end - but I know that for most of our more recent pitches we've been up against a number of other web design companies, and more often that not, the client selects us. Hooray for us!

We're able to keep our costs down because Tom, Sue and I work on a co-operative basis - collaborating when the project demands it, and doing our own thing in between times - and we all work from home which means we don't have the overheads that come when you're a larger company with offices and support staff and stuff. It does mean we work about twice as hard as you do when you're working for someone else, but hey - that's what being self-employed is all about.

I get the feeling that being a small company is working in our favour on a deeper level too. I think that, as well as the obvious financial benefits in choosing a small company over a larger one with larger overheads and higher costs, there might be a bit of psychology going on as well.

Seems to me that in a recession there's a need to feel that you're really getting your money's worth - and that unconsciously it might feel as though you're doing your bit for the company if you choose the good quality reasonably-priced option rather than the larger, more luxurious and more expensive option. That might mean picking us over a larger, more high-profile and more expensive company.

There's certainly also a definite down-sizing of projects this year - more re-skins, more temporary solutions - and as budgets come down, more of them fit into our price range, which means there may well be a bit more work out there for companies like us this year than in a normal boomier year. Whatever the reason, it's all working out well for us so far.

I'm loving it. I still miss Shift - but every once in a while I get to go back and do a bit of contract work for them, which is awesome. They are such great people. It's nice because the projects we work on are about one-tenth the size of an average Shift project, which means our client bases are completely different. This is a Good Thing. I wouldn't really want to be in competition with my old workmates, after all!

It's funny how things turn out, eh? When I was writing Eulogy for my job at the end of last year I didn't imagine things would be going so well for us six months later. Long may it continue. And please Karma Gods don't jinx me for actually putting pen to paper (keyboard to screen?) on this very delicate subject!

I just think it's good to celebrate the fact that in the midst of tough financial times, you can still make a living if you work hard to get the work - and then you work hard actually doing the work :)

Technorati tags: , , , , , , , , , , , , , .

Read the full post

Tuesday, May 26, 2009

John Key, you confuse me

OK, so that's not really much of a surprise, seeing as there's very little that John Key and I would be able to agree upon. But his latest announcement has me even more confused than usual.

Seems Mr Key wants to encourage loads of expat Kiwis to come home and "plug the brain drain" in order to help us out of the recession.

Call me stupid, but - um - where exactly are the jobs for all these people going to come from? John Key seems to take great delight in booting as many public servants out of their jobs as possible (why do you hate public servants so much, Mr Key?), and has been known to make more public servants redundant in a single day than the total number of jobs saved by his much vaunted 9-day fortnight plan - and yet he now seems to be saying that there are tons of jobs out there for all those highly-educated Kiwis who've left EnZed for pastures new.

I hate to break it to ya, John - but I think you'll find that many of those jobs are either filled already, or no longer exist.

Take my field of expertise for example - the New Zealand IT industry. A year ago it was definitely true that we needed more IT professionals here. I could have walked out of my job a year ago and found 5 great positions within a week. Today that's definitely not the case. I've said before in my blog that if you apply for an IT job these days you'll more than likely be up against hundreds of other people (no exaggeration - apparently a webmaster position advertised at the Ministry of Justice recently garnered 300 applications!).

These days you're lucky to even get an interview in my experience - I've stopped bothering because it's just not worth my time and effort - I'm doing much better with contract and freelance work - but that's not what Key's talking about. He's talking jobs and Kiwis coming home to set up new businesses and suchlike, and I think he's dreaming.

He's certainly not talking about public servant positions (see above!) - by the time he's finished there won't be any of those left at all - and yet it's where a heck of a lot of highly-educated Wellingtonians end up. I know a bunch of ex-public servants who've gone to England to work, and I think some of them do want to come home - but they won't find many openings in Government right now.

So what's he talking about? I think you need to be a lot more specific John - are you talking nurses, teachers, doctors, police etc? I don't think there's much of a chance of persuading expat Kiwis in those professions to come home - you're freezing (already crappy) pay for most of those jobs "in a spirit of working together to help NZ ride out the recession", and I can't imagine many people would give up a job they already have overseas to come home and battle for one here.

Personally, I'd rather all those IT professionals didn't come home right now. There's enough competition around here already, without having to compete with a whole bunch of web designers fresh off the plane from London. Call me selfish, or call me realistic - but I truly don't understand where he thinks these jobs are hiding, when more and more job losses are being announced every week.

Redundancy sucks, but I've found out it's not the end of the world - it can be a new beginning if you're prepared to work at it. But persuading Kiwi expats to leave good jobs overseas to come home in the middle of a recession when they'll be up against all the usual applicants here PLUS a whole bunch of recently-made-redundant job-seekers - I think that's unrealistic, and dishonest, and pretty short-sighted.

Think again, John. This expat Kiwi plan ain't gonna fly.

Technorati tags: , , , , , , , , , , , , , , .

Read the full post

Tuesday, May 12, 2009

Reported Attack Site! (only not)

What a complete nightmare.

If you've visited my website since this morning, and you're using the very wonderful Firefox as your browser of choice, you may have gotten the same shock I did when I went to check it today...

Instead of my lovely welcoming homepage you are currently subjected to a greyed-out screen with a big red box in the middle that loudly proclaims "Reported Attack Site! This web site has been reported as an attack site and has been blocked based on your security preferences."

WHAAAATTT????

I read the auto email from Google again (which is what had prompted me to check my site this morning) and follow the instructions. Check the source code for injected weird blocks of code or anything that shouldn't be there etc etc. Absolutely clean and pristine, nothing wrong with my source code at all. What's going on?

I call my ISP and they sheepishly admit it's all their fault. Someone who has a website hosted on the same server as mine has found a way of randomly (and only occasionally) intercepting a Google request for other sites on the server (including mine) and has been able to redirect the person Googling for my site to their own (malware) site instead. So now Google thinks I have malware on my site which I don't. I'm not a happy bunny right now.

I find it incredibly frustrating because I now have to request that Google remove me from their "no-fly" list (which I shouldn't be on anyway) and in the meantime all my clients and potential clients will think I have a dodgy site and am therefore a dodgy person to do website dealings with.

I've done the requesting-a-review-from-Google thing, but have no idea how long it will take for them to clear me - and meanwhile my reputation is potentially heading rapidly south as potential clients see the warning page and race off in the opposite direction!

Nightmare!

Technorati tags: , , , , , , , .

Read the full post

Monday, May 04, 2009

OK Universe, you can slow down a bit now

So you remember how I was having a little freak-out in March because I had one or two days in a row where I had no work to do?

I realised I hadn't actually Asked The Universe To Provide for a wee while, so I asked - and now I have work coming out of my ears.

How funny. I certainly won't be signing on for a little while longer, that's for sure.

I see the feast or famine thing time and time again with contracting and freelance work. Happens all the time. I guess that's because there's only one point where "too much" and "not enough" are perfectly balanced, whereas there are many points where one side of the seesaw is heavier than the other, but still - it can be somewhat exhausting, this not-knowing thing.

I guess that's made up for by the fact that you earn a little more per hour when you're freelancing or contracting, but then again, there's a heck of a lot of preparation work involved too - especially when you're doing all the pitching for jobs and much of the project-managing, like I am.

I spent the entire week last week either at planning meetings, presentation meetings, or writing proposals and drawing up website wireframes. All prep work really, but when it goes well, it's a very worthwhile investment.

Sue and I won an awesome contract a couple of weeks ago which we're completely thrilled about, and she's working on the designs as I write this. Can't wait to see them - I know they're going to be lovely.

Tom and I are working on another website for a freelance client at the moment - I've been working on the design for the last couple of days and it's really coming together nicely. Hope the client likes my colour palette. We shall see.

I'm definitely feeling very positive about being a contractor and freelancer at the moment (probably because I've got heaps of work on!) - and I do like the freedom of it, even though writing pitch proposals isn't my favourite thing... This morning for example I was able to watch the ATP tennis delayed coverage before I stared working - which I certainly couldn't do if I were an employee. Heh.

I do miss being in a team though. I did a couple of week's work at Shift recently and OHMYGOD it was so nice to be back there again. I love those guys! You might think it would feel weird to be back there, but it wasn't at all - it was just really nice.

I think I'm turning into a crazy old lady though - because I'm spending so much time working from home I've noticed I've been talking to myself rather a lot (or the cats) - there being no-one else around to talk to. I just have to make sure I don't do it in public too much, or my secret will be out!

OK, back to work - wrangling logos into a tiny space is always fun.

Later!

Technorati tags: , , , , , , , .

Read the full post