Archive

Archive for February, 2012

SASS CSS Pre-Processing Technique

February 18th, 2012 No comments

Can You Show Me That In Red, With A Wider Sidebar And In Verdana?

How CSS Pre-Processing Revolutionises Your Relationship With Indecisive Design Clients
Every designer has been there at some point. After delivering the perfect design image to the client – almost exactly mirroring the sketches and discussion at the meeting a week ago – the dreaded e-mail comes back asking for a colour, style and layout change.

A whole host of changes are required that will take hours to complete – hundreds of individually coloured, shaded and styled elements all have to be recoloured to ‘try out’ this new red look. On top of that they want to see the sidebar changed – cue some edits to all your text boxes, sidebar area and don’t forget to change all the fonts too! The old way of getting sign off on design can be a real pain – working in an image editor doesn’t feel like the right way to go but editing hundreds of lines of CSS wasn’t a whole lot of fun either.

CSS Preprocessing Introduction
The idea that we can extend CSS by adding some features then processing that code to produce the final CSS is called preprocessing CSS. SASS (Syntactically Awesome Stylesheets) is one of the most popular forms of this technique and includes four powerful new features – namely nested rules, variables, mixins, selector inheritance and many useful functions.

The one that will be most powerful when dealing with our indecisive client is variables. Some edits that would have taken hours such as the edits in our title example can take simply seconds using a code based design approach and combining that with CSS preprocessing.

The Steps Using Plain CSS
Designers working straight in code have long enjoyed the benefits of being able to simply change some CSS elements and see an immediate response in their browser window. Fonts can be tried out, colours quickly changed and clients can experience the output live instead of statically on a painstakingly recreated image. When a client requests as many changes as above, however there can still be a lot of steps.

Firstly the designer would have to find all the instances of the old colour (let’s say blue) in the design and amend those to red’s. The correct shades of red (darker or lighter) for all other elements would need to be calculated then applied to those elements by hand. Some use of ‘search and replace’ will speed this step up.

After adjusting the colour a simple search and replace is likely to solve the font issue. Some checking to ensure the fallback fonts are also adjusted will be required though – it’s no good changing the main font from a serif font to a sans-serif only to leave all the fallback fonts as serif varieties. Luckily again some search and replace will save time here.
The sidebar width probably depends on the overall sheet width either through a calculation based on the fixed width of the site or simply a percentage of a fluid width. This will likely be a simple adjustment regardless of whether we use preprocessing. The technique for doing the calculation using preprocessing is exciting, however as for some complex grid based designs the size of the grid could be amended and the whole site fall into place in a site coded in SASS.

Some SASS Examples
Let’s see how variables and calculations could be applied to the width.

$sheetwidth = 1000px;
$sidebarwidth = 250px;
.article {
width = $sheetwidth - $sidebarwidth;
.
. (rest of our article CSS)
.
}

As you can see above if your client asked for a wider sidebar you could simply amend that variable in one place in your document. All other elements (such as the width of our articles) that depend on that variable would automatically be resolved in the CSS that SASS outputs when you process it. Applying this to some more complex designs can lead to absolutely huge savings.
There’s some even more fun changes you can apply to colours. Imagine a swap from red to blue in normal CSS. Lots of different shades might have to be changed manually. In SASS where the shades of elements can depend on each other (for example a border that’s darker than a background) we can simply have one change to make to completely change our site from red to blue.

$siteshade = #000061;
.somebox {
color: $siteshade;
background-color: lighten($siteshade, 60%);
}

All we need to do to change from blue to red is to change the variable $siteshade.
Hopefully this introduction to SASS and the powerful use of variables in your straight to code designs will inspire you to take this step in your next development project. With huge time savings, easier to modify code and the opportunity to trial your designs in live format with your clients, there’s no end of positive opportunities for your next project whether it’s an American car insurance comparison site or a personal blog for an artist.

Categories: Web Tags:

How Mobile Changed The Design World Forever: History Of Responsive Design

February 10th, 2012 No comments

How Mobile Changed The Design World Forever: History Of Responsive Design

Have you ever heard of i-Mode? No? Well of course you have heard of its little brother WAP from back when you first checked an e-mail on a mobile phone. Right from the beginning our mobile Internet experience was founded on these failed concepts. Painstakingly recoding websites to an inferior platform was a failure. Luckily a failure that we have long forgotten. The future is a design world where we also forget many other failed attempts and finally see the first signs of the mobile Internet that changed web design forever. It’s time to find out the history of this revolution.

Moving On From WAP and i-Mode – The ‘Fully Capable Device’

Thinking back to the days of WAP and i-Mode it’s not hard to see why users were so frustrated. Difficult to navigate text only sites or poorly formatted mobile only sites that didn’t bear any resemblance to the Internet they’d fallen in love with at home weren’t much to set people’s imaginations free. So we moved on to the revolution that started it all – ‘The Fully Capable Device’ such as the iPhone.

“I believe the iPhone (a phone that uses the traditional TCP/IP model) is closer to the mobile phone of the future, compared with the latest Japanese mobile phones.” i-mode’s creator, Takeshi Natsuno

The problem with these fully capable devices initially were that websites were not at all compatible with comfortable use on a small screen. Users went from not being able to see anything because it wasn’t there in the first place (WAP) to not being able to see anything because of the brutal amount of scrolling and zooming that was needed! There’s little point ranking number one with great search engine optimisation if your users can’t enjoy the site! Let’s give credit where it’s due however - these first devices set users free and made designers face up to the fact that users wanted the ‘real Internet’ on their mobile devices and those devices were now fully capable of delivering it.

Making It Fit – Specialist Mobile Browsers

All this scrolling and zooming led the software developers at Opera to realise that a better alternative might be to rearrange the content into one nice, neat column. Text was re-sized, excessive graphics and formatting were scaled or removed and menus made more touch friendly. On some of the less capable devices out there with really tiny screens this little browser was a revolution. To most of the better devices it solved a problem in an acceptable manner but hardly brought the joy of surfing beautiful sites to mobile users. The success of these browsers is as much a symptom of a failure to adapt by the design community as it is a feature of the success of Opera – users had to choose between a site with no adaption to mobile use or one that was hacked into shape by software.

Putting The Pieces Together: Responsive Design

Luckily things have started to move in the right direction. Designers can see the benefits of one easy to view column to mobile users on small devices – the huge popularity of Opera Mini proves this. However they also must capture vibrant colour, styles and a design that users love if they are to keep their online following as users move into the mobile world.

Sites that rely on generic templates (such as the WPTouch plug in for WordPress) to make their mobile sites or those that simply rely on users reprocessing their sites into a vaguely acceptable format by their browser miss a huge opportunity. Those who embrace that opportunity and allow their site to respond to the viewing size of devices – always looking great and always being appropriate to the user experience of that device - will grab an increasing share of this mobile market. Those who do not adapt will be left behind.

The Core Principles of Responsive Design for Mobiles

Responsive design was driven by mobile devices – they were the first devices so small that they required something to be done to content to make it easier for users to consume. The reason it’s a design revolution is that some sites now display better on notebooks and huge screens than they ever did when a 960 pixel fixed width was used as standard.

Responsive Web Design

By responding to the screen size (browser window) available, this design technique allows one set of high quality content and high quality features to be shared by all device users – now and in the foreseeable future. Some of the tips from Opera are taken on board - usually a nice one flowing column is used- sometimes a site even scales in steps moving one sidebar for netbooks then dropping them both to one column for tablets and phones. Perhaps the menu has nice big square finger-friendly buttons on a smaller screen (most likely to be a touch device) but has a flowing, graphics based menu with drop downs on a wide screen HD monitor. Images will automatically fit the columns no matter what size of device is being used. Designers have a real challenge in ensuring that content looks great and is enjoyable to consume on all devices, responsive design by allowing them to cater for the viewing area allows them a simple, yet elegant solution.

Finally mobile users can dream of the ‘Real Internet’ on their phones. The good news is it’s just around the corner.

Categories: Mobile, Web Tags: