Archive for February, 2009

Learning web design.

A month ago, I wrote an article on web design education in Mauritius which got me some sour reactions from so-called “web design professionals” from Mauritius. Sure, the first reaction in Mauritius is to insult then think. But do you do it when you’re a professional? Anyway, this is their way of doing the business: ego and self-satisfaction ensuring that all the inequalities prevailing in Mauritius carries on healthily. [Rant and denounciation off]

Coming back to the issue of web design education, a lot has come out from the ongoing contest to win a copy of Mark Boulton’s “Designing for the web”. Read the comments and you’ll get a great view of how most people in the industry have learned their trade. As a matter of fact, school and university lectures are practically non-existent in web design. Most of the time this goes in this order:

  1. Learn from the web with online tutorials
  2. Learn by scouting portfolios and “big hats” in the trade
  3. Books (depending on how they are written, bland and factual ones are not favourites)
  4. Ebooks/PDF books (new technology has us)
  5. Practice (trial and error)

Once again, read through the comments (and add yours if you’re interested in the topic or the contest) and get to know how people have started out in the domain.

Along with these are two excellent overviews that I would like to share. These might even be the groundwork for a new way of teaching or building a curriculum around web design:

  • Teach the Web has published a Monograph where the underlying question is “What to teach to the next generation of web professionals?”. Leslie Jensen-Inman has interviewed 32 top category web designers to understand that intricacies and issues of learning web design and the results are astounding. They are to the point and well documented. A real view of what web design education should be.
  • The School of Visual Arts has an MFA in interaction design as well as a great active blog on the theme of interaction design. Readers have requested reading recommendations in terms of interaction design and this has given a superb list of books to be assigned/already assigned to their courses.

    These could be landmark texts, underdogs, or critical reads, or stepping stones to other fields.

[Festive Hands] Coding the structure.

Welcome to this new episode of the Web Design Bureau of Mauritius CSS theme building. Today, we’ll dive directly into the code and start coding the structure. If you want to refresh your ideas on this structure just drop on to the previous structure article where we detailed it. At the end of the last post we had a full HTML structure with divisions. Now, we’ll work with the main css file only to get each division to step in its place. So, fire up your text editor and open the style.css file.

Margins and paddings.

Margins and paddings are inherent to certain types of blocks and can be added to practically any tag in HTML. One thing that I like to do when beginning a project is to get all the margins and paddings out of the way so that I can control every element, especially when using the box model which is the basis of all actual CSS web design (new elements in CSS3 will make use of different, and hopefully easier, solutions but that’s not for tomorrow). First thing to do then is to clear all margins by using the asterisk wildcard.

* {
	margin: 0;
	padding: 0;
}

Centring the document.

Remember that our main document was called #document. We’ll need to centre it horizontally. This is one of the problems designers didn’t know how to work around especially in IE browsers and which lead to the use of embedded tables. The solution is fairly simple.

#document {
    margin: 0 auto;
}

There are different ways of specifying margins (and paddings, which follow the same concepts) in CSS. The margins are specified following a clockwise pattern starting from the top.

#document {
    margin: 10px 20px 10px 20px;
}

This would be the equivalent of writing:

#document {
    margin-top: 10px;
    margin-right: 20px;
    margin-bottom: 10px;
    margin-left: 20px;
}

What catches the eye is that the first version is shorter and will thus consume less bandwidth on page load. Now let’s say that we needed 10px margins all around we would just have written:

#document {
    margin: 10px;
}

Looking back at our document with 4 margins with 2 of 10px and 2 of 20px we notice that there are common denominators. The 10px are for top and bottom and the 20px for left and right. This can also be short-handed to 2 elements:

#document {
    margin: 10px 20px;
}

The browser will read 10px top and bottom and 20px left and right.

Other declarations of margins can be done in percentage (%) or automatically (auto) where the browser will calculate the margin automatically from the borders of the height or width available. This is what is used to centre the document in the browser.

#document {
    margin: 0 auto;
}

Margin 0 (notice that we don’t use 0px because 0 of something is nothing) specifies that we do not have any margin top or bottom and auto for left and right will force any browser (understanding this code) to centre the document depending on the browser’s viewport width. Actually, looking at my design, I need a 20px margin top and bottom of my page so I’ll modify the code for it.

#document {
    margin: 20px auto;
}

Width

The site, as specified in the structure article, needs to be 960px wide to be fully viewable in a standard 1024px screen. This is done by adding the width to the #document as it is the utmost element holding the page.

#document {
    margin: 20px auto;
    width: 960px;
}

This keeps all the elements in the page at 960px wide and centred.

Overflow.

The CSS overflow property specifies what to do with an element when its content doesn’t fit exactly. This is useful especially for height management. You might have noticed that no height has been specified in our #document. This has been done because I want it to automatically increase its height whenever content is added to any element inside it. The ‘hidden’ property allows us to specify that no scrolling effect in the division is needed, hence, the division should always adjust itself according to the height imposed by any content present. For example, if #sidebarLeft gets longer than any other element #body should increase its height, pushing down #footer and increasing #document's height. All this works with the overflow.

#document {
    margin: 20px auto;
    width: 960px;
    overflow: hidden;
}

Inner divisions.

Back on the structure we have 3 major divisions inside the document. These divisions offer the “content” framework. They are the #header, the #body and the #footer. These elements are simple to understand. They are all 960px wide and will also be modifying their height according their inner contents too. This will be simple to code then. Here we will be using some CSS shorthand. Instead of declaring thrice each element and stating their height and overflow, we will declare all this in one go. You can use commas to line up selectors in CSS. This way:

#header, #body, #footer {
    width: 960px;
    overflow: hidden;
}

All these elements have the same properties now.

Content and sidebars.

Finally we get to the last divisions in our structure code. The final elements are the #content and #sidebars (left and right). The idea in the structure is to distribute all of them in specific widths at specific positions. Specifying the widths is fairly easy. These will also have overflows hidden as explained earlier.

#content {
    width: 450px;
    overflow: hidden;
}
#sidebarLeft {
    width: 300px;
    overflow: hidden;
}
#sidebarRight {
    width: 170px;
    overflow: hidden;
}

Floating.

CSS float property allows you to specify where an element has to be positioned (left or right or not at all). Here we will be using the left and right floats.

Looking at our structure it is obvious that the #content box will be positioned on the left. It will thus take a float to the left. Its width being given all the other elements will follow to fill the space left. Don’t fret if things look broken.

#content {
    width: 450px;
    overflow: hidden;
    float: left;
}

The other sidebars would also look great if they were left floated. However, our visual structure shows that there should be a 20px gutter between the boxes. There are 2 ways of doing this.

First solution, all floats to the left.

#content {
    width: 450px;
    overflow: hidden;
    float: left;
}
#sidebarLeft {
    width: 300px;
    overflow: hidden;
    float: left;
    margin-left: 20px;
}
#sidebarRight {
    width: 170px;
    overflow: hidden;
    float: left;
    margin-left: 20px;
}

The 2 sidebars take a left margin of 20px each providing for the gutter. If we add all our widths and margins we get this. 450+300+170+20+20 = 960px, being the document width. This is how it works.

The second solution uses a right float just because I didn’t want to add a margin (lazy b*st*rd)! Instead of calculating the 20px margin and adding it I just forced the last box to float to the right. It gives the same result.

#content {
    width: 450px;
    overflow: hidden;
    float: left;
}
#sidebarLeft {
    width: 300px;
    overflow: hidden;
    float: left;
    margin-left: 20px;
}
#sidebarRight {
    width: 170px;
    overflow: hidden;
    float: right;
}

Conclusion

As a means of conclusion to this part of the tutorial we now have selectors set for the whole layout. As you can see, we have not touched at our HTML code while doing this and the whole page has its layout straight and robust. Along with that the page renders the same in IE6 and Firefox 2/3. I haven’t tested it on IE7 yet. I have linked to the W3C pages dealing with some of the selectors and concepts used in this post. It is always interesting to have a look at those and learn from them.

You can download the source files here.

Designing for the Web… Win! Win!

One of the last tweets I saw today stated: “Reading is hazardous for your stupidity…”. Thanks for the message pal! Looking back at what has been hazardous for my stupidity through the past week is the PDF book I bought off Five Simple Steps by Mark Boulton.

designing-for-the-web

What I like with Web design guru Mark Boulton is his transversal view of web design and his direct and concise way of explaining the underlying design concepts. It reads with a great pace while giving you “to the point” information on webdesign in a 100+ PDF printable, personalised book! This is another example of a great Web design book to own. You can read other writings from Mark Boulton on his blog.

Having said this, the Web Design Bureau of Mauritius is offering 2 (yes TWO) copies of Mark Boulton’s book. Just leave a comment on this post about your experience of “learning” from books (most web designers, designers or programmers do so at a certain point in their lives) to enter the contest which will end on Monday 2nd of March 2009. I can assure you that you’ll even love the book’s layout!

Shepard Fairey Obama poster fiasco.

For many designers, Shepard Fairey is a genius who has imposed a style, worked on it and sent it to the top places in the design world. For the non designers, the name does not ring a bell. If I said “Obey Giant“, it starts tingling somewhere in the brain. And if I say Barack Obama Hope poster… they’ll say “yeah”!

Now, what’s the problem? Not Fairey’s talent and style certainly. It comes from somewhere else. Copyright infringement. Yeah that’s right. On what? On the said poster known as Hope. The Associated Press is claiming that it will sue Shepard Fairey for this infringement because he has used a photo published by AP without permission. The design community all over the world is talking about this and positions are being taken for or against Fairey. The court ruling will decide how much you have to change an image for it not to be an original any more.

Original picture of Barack Obama and the Hope Poster

It is obvious that the photo has been a direct reference for the poster but how can a person like Shepard Fairey fall in the copyright infringement trap? Second question: why did the AP wait for so long to get the case out? Was it because they were supporting the Obama campaign and did not want to let it be spoiled by such a case or is it because the poster has had such an impact and is still being sold as a piece of History on ebay that they want their share of the cake? In any case, this does the buzz for Fairey and the AP. This poster is going to get more famous than it already is.

Hope poster on sale on ebay

You can still catch one of the posters still on sale on ebay before they go either overpriced or illegal.