NETTUTS - Web development tutorials and links http://nettuts.com Spoonfed Web Tutorials Thu, 15 May 2008 09:44:31 +0000 http://wordpress.org/?v=2.5 en How to Build a Maintainable Site using CushyCMS and Twitter http://nettuts.com/site-builds/how-to-build-a-maintainable-site-using-cushycms-and-twitter/ http://nettuts.com/site-builds/how-to-build-a-maintainable-site-using-cushycms-and-twitter/#comments Wed, 14 May 2008 06:27:49 +0000 Collis Ta'eed http://nettuts.com/?p=22 ]]> Sometimes it seems there are as many CMS products out there as there are web developers. In this tutorial we’re going to build a simple one-page site and then in less than 5 minutes, get it setup with a Twitter feed for daily updates and with CushyCMS for general content. If you haven’t seen it, Cushy is a completely free and extremely simple to use product that’s come on the market recently.

The Brief!

Recently I came to the realisation that I should really have a personal site. I don’t take design work, but it’s nice to have a place to refer to when I write bio’s and so on. Also a month or so ago I started using Twitter to put up my daily thoughts on business, the web and stuff. This seemed like a logical thing to stick on my personal page. Also it’s important that the site be easy to manage so I don’t let it get outta date. So you could say this was my brief.

First a Design

Before getting to the build I spent a few hours in Photoshop trying some ideas. I need something simple - I don’t have time for anything else, professional - who knows who is going to visit, and nice looking - I do claim to be a designer right?

Anyhow here is my design. I used a nice vector illustration from iStock - always good for doing something quick that looks awesome! I used a really nice and free font - Colaborate Thin. And finally a nice orange-blue colour scheme that by a stroke of good fortune turned out to match my orange photo!

So I won’t dwell on the design too much. If you click the image below you can get a large version of the JPG in case you want to follow along.

Step 1 - Cutting up Images

Looking at the design in Photoshop, it’s clear there are a bunch of images I’m going to need. If this were a more complex design, I’d use Photoshop’s Slice tool, but it’s pretty simple, so I’ll just crop the file and create a bunch of images - one for the table, one for all the titles, one for the "follow me" bubble, one for the nettuts image and one for the photo of my giant forehead! Here are the images I made:





Note I’ve only shown one title, but of course I actually made lots of those.

Step 2 - Planning the HTML

Next we plan our HTML layout. Very deliberately this site is going to be extremely easy to build. It’s simply a sequence of blocks. Previously I’ve written about how to us Absolute Positioning to make a layout, this time we’re going to use super simple Relative Positioning.

As you will recall when you place elements on a page they have a natural place they go to, relative to elements that came before. Because we’re not using columns or really anything fancy in this design it’s going to be perfect for using this regular postioning.

As a general rule, whenever you want to make your life easy in HTML, it’s best to do things in blocks laid out horizontally. This is the easiest way to work with CSS and doesn’t require much fiddling for browser compatibility. As soon as you start putting in columned layouts, things get a bit trickier. So we’ll save that for another tutorial, on another project.

So anyhow the layout we’ll use is something like this:

Main Heading

Section Heading
Div Block of Content

Section Heading
Div Block of Content

Section Heading
Div Block of Content

... and so on...

The best thing about this plan is that later on if we suddenly go "hey I wish I had my an extra block for favourite images", it’s like no problemo! Just slip it in, use the same CSS classes and everything. This really is the simplest layout around, and with a nice design it can look really cool nonetheless!

Step 3 - Laying out the initial HTML

OK Create an index.html file and then here’s my first stab at the HTML, it’s not perfect and is missing the Twitter bit, but it’s a good starting point and we can make a few adjustments later as we go:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<title>Collis Ta'eed - A Little About Me</title>
	<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
</head>

<body>
<div id="container">

    <h1><span>Hi I'm Collis, entrepreneur, blogger and designer.</span></h1>

	<img src="images/title_about_nm.jpg" alt="About Me" />
    <div id="about" class="content_box">

    	<a href=""><img src="images/photo_sm.jpg" class="photo" alt="Collis" /></a>
	    <p>After working as a web designer - both employed and freelance - I cofounded a startup with a few friends in 2006.  Our company, <a href="http://eden.cc">Eden</a>, has since grown and I've had the good fortune to work on lots of very exciting and interesting projects, everything from <a href="http://flashden.net">FlashDen</a> to <a href="http://blogactionday.org">Blog Action Day</a>. </p>

		<p>Thanks to the brilliant nature of the web, I'm currently living and working out of Hong Kong and travelling the world. You can find me online on <a href="http://twitter.com/collis">Twitter</a> where I post random thoughts, or you can send me an email from the form at the bottom of this page.  Thanks for stopping by!</p>

    </div>

    <img src="images/title_thoughts_nm.jpg" alt="Thoughts via Twitter" />
    <div id="thoughts" class="content_box">
    </div>

    <img src="images/title_project_nm.jpg" alt="Latest Projects" />
    <div id="project" class="content_box">

    	<a href="http://nettuts.com"><img src="images/project_nettuts.jpg" /></a>
        <a href="http://nettuts.com">NETTUTS</a>
		<p>In April Eden launched a sister site to PSDTUTS which Iíve been working on.  The site hosts web development and design tutorials.</p>

    </div>

    <img src="images/title_links_nm.jpg" alt="Links" />
    <div id="links" class="content_box">

    	<p>Some links to sites that I have a hand in:</p>

        <ul>
        	<li><a href="http://flashden.net">FlashDen</a> - Our main Eden project</li>
        	<li><a href="http://freelanceswitch.com/book">How to Be a Rockstar Freelancer</a> - A book I cowrote with my lovely wife</li>
        	<li><a href="http://freelanceswitch.com">FreelanceSwitch</a> - The highly successful blog on freelancing</li>
        	<li><a href="http://psdtuts.com">PSDTUTS</a> - The best photoshop blog around!</li>
        	<li><a href="http://blogactionday.org">Blog Action Day</a> - A nonprofit, annual event</li>
        </ul>  

    </div>

    <img src="images/title_contact_nm.jpg" alt="Contact"/>
    <div id="contact" class="content_box">

    <p>I'm the first to admit that Iím not very good at answering all my emails, but I do my best and if you have need, then you can <a href="mailto:whoiscollis@gmail.com">email me</a>.</p>

    </div>

</div>
</body>
</html>

Things to note:

  • I’ve linked to a file called "style.css". This is where we’ll place our styles later, so go ahead and create a file with that name.
  • The whole thing is inside a <div id="container">. I did this partly out of habit to be honest, but I’m going to use the <div> to place my background image. and to make sure I don’t stray out of the 1000px width that I need to stay inside of for people on 1024px x 768px screens.
  • The "logo" heading is inside a <h1><span></span></h1>. Then we’ll use the <span> part to make the text invisible and give it a background image so it looks like the design. This has benefits for SEO, and was a suggestion from the comments of a previous NETTUTS tutorial (thank you commenter whose name I’ve forgotten, but whose suggestion I’ve taken to using! )
  • Each section is an <img> title and then a <div class="content_box">. I’ve filled them in mostly with content, except for the Twitter box which we’ll worry about in the next step.

Step 4 - Add a little CSS

Now we’ll add a tiny bit of CSS to make the page look a bit more like where it’s going to end up. Create your ’style.css’ file and place these two definitions in:

body {
	background-color:#191e25;
	margin:0; padding:0;
	color:#5f6874;
	font-family:"Lucida Grande", "Lucida Sans Unicode", Arial, Sans-serif;
	font-size:13px;
	line-height:21px;
}

#container {
	width:900px;
	padding:50px;
	padding-top:30px;
	background-image:url(images/Computer.jpg);
	background-repeat:no-repeat;
	background-position:top right;
}

A couple things to note:

  • I’ve set a font-family that uses a slightly unusual set of fonts. Lucida Grande is on most, if not all Macs, and Lucida Sans Unicode is on most PC’s, so most people should see a nice Lucida typeface. If not they’ll still see Arial or some default sans-serif. Either ways Lucida looks cool, and that’s what I get to see :-)
  • I’ve used my <div id="container" to place that computer image in the background, located at the top and right, and set the width of my content area to be 900px + 50px left padding + 50px right padding = 1000px.
  • The 50px padding we’ve set in the container will effectively do most of our positioning for us on the page.

And here’s how our page is looking now:

Step 5 - Now Let’s Grab the Twitter

Now we add the content from Twitter. This is a great way of making the page feel really dynamic because I update my Twitter feed most days. Also it’ll be a way of driving people over to add me to their Twitter networks, and then in the future when I launch new sites I can drive traffic to new places. So really it’s all part of my not-particularly-devious plan.

So Twitter have made grabbing their feed really easy for us, just do the following:

  1. Log in to your Twitter account
  2. Click that Yellow box in the right hand bar that says "Put your updates on your site!"
  3. When prompted for MySpace, Blogger, etc, choose "Other"
  4. Select the HTML/JS option so we can style it up with CSS later
  5. Then set the Number of Updates (I set mine to 3) and copy + paste the code.

Here’s the process in images!




And here’s the code that Twitter gives us:

<div id="twitter_div">

<ul id="twitter_update_list"></ul></div>
<script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>
<script type="text/javascript" src="http://twitter.com/statuses/user_timeline/collis.json?callback=twitterCallback2&count=3"></script>

Note I deleted the <h2> bit that Twitter inserts in, because we don’t need an extra title, we’ve already got one. Then it’s also worth taking Twitter’s advice and moving the two Javascript lines to the bottom of the page just before </body>. That way it loads in last. Because Twitter is notorious for its downtime, this will stop them from killing our site accidentally!

So by looking at the HTML they’ve given us, we can guess that the Javascript is probably going to fill in that <ul> with our tweets inside the <li>’s it’ll place there. And that is exactly what it does do…

Step 6 - Add Google Analytics

Now at this point I will also add in some Javascript to hook my site up with Google Analytics. I think most web developers have heard of Analytics, but if by chance you’ve been living under a rock, I really recommend trying it out. It’s free, and it’s a powerful way to monitor your traffic. When you’ve gotten an account, you simple Create a New Website Profile, enter a domain name and you’ll get in exchange some Javascript code to paste into your HTML documents. Easy peasy!

Step 7 - More CSS

Next we’ll add a couple more styles that will get us even closer to our end product. They are:

a img { border:0 }

a { color:#cc5630; text-decoration:none; }
a:hover { color:#ffffff; }

.content_box {
	width:590px;
	margin-top:15px;
	margin-bottom:30px;
}

Here we are removing borders of linked images (i.e. the link to NETTUTS and the photo of me which will link to a bigger version), also we’re setting the colour of our links on the page in general. Finally with the content_box style we set a width for our content blobs and using top and bottom margins separate them up on the page. Here’s how our page looks now:

The next thing to do is to get some text-wrapping happening around our two images. The first thing to do is add an class to the images we want to wrap (the photo and the nettuts image). I didn’t think to do this earlier, but can see I need to now. So we change the images to have:

<img src="images/photo_sm.jpg" class="photo" alt="Collis"/>

Then we add a quick style to make the float to the left with a bit of a margin, like this:

img.photo {
	float:left; margin-right:20px;
}

Unfortunately while nice and simple, this solution doesn’t quite make the grade because my text block is too long, so it’s wrapping … booo! Never mind, easily fixed. We’ll place that text in it’s own block and make it float too.

So we’ll adjust this content_box so the HTML code is now:


	<div id="about" class="content_box">

    	<a href="/images/collis.tif"><img src="images/photo_sm.jpg" class="photo" alt="Collis"/></a>
	    <div class="about_text">
            <p>After working as a web designer - both employed and freelance - I cofounded a startup with a few friends in 2006.  Our company, <a href="http://eden.cc">Eden</a>, has since grown and I've had the good fortune to work on lots of very exciting and interesting projects, everything from <a href="http://flashden.net">FlashDen</a> to <a href="http://blogactionday.org">Blog Action Day</a>. </p>

            <p>Thanks to the brilliant nature of the web, I'm currently living and working out of Hong Kong and travelling the world. You can find me online on <a href="http://twitter.com/collis">Twitter</a> where I post random thoughts, or you can send me an email from the form at the bottom of this page.  Thanks for stopping by!</p>
		</div>  

        <div class="clear"></div>

    </div>

So you can see I’ve wrapped the text in a <div class="about_text"></div> and then added a <div class="clear"></div> at the bottom. This extra <div> will be used to clear the floats, otherwise the floating layers would wind up going over the top of the content further down the page. So here is the additional CSS code to make this work:

.about_text {
	float:left; width:380px;

}
.clear { clear:both;}

We have to give our about_text block a width so it floats alongside the photo. Now that fixes our problem nicely. However if you look at the image shown below, it seems like there is a weird gap that’s appearing between the top of our text block and the image.

Weird gaps are the worst to come across, because it can be really hard to figure out what’s causing them. In our case here though I happen to remember that the <p> tag has a default top margin which if we get rid of will probably solve our issue. Here’s the code to fix this:

	p { margin:0px; margin-bottom:20px; }

So now every paragraph will have no margin except 20px below it (spacing out the next paragraph element).

Step 8 - Replace our Heading

As I mentioned earlier we’re going to use a bit of CSS to replace our <h1> tag at the top with the much nicer looking image so we get SEO benefits and nice looking title. If I was conscientious I would do this technique with all those subheadings too … but I’m not!

So all we’re going to do is use the <span> tag that we so cleverly placed earlier to set the text’s display to none - making it hidden. Then we’ll give the <h1> a height so the background image doesn’t get cut off, and finally we’ll set the image to appear. Here’s the CSS code we need to make this happen:

h1 {
	background-image:url(images/title_main.jpg);
	background-repeat:no-repeat;
	height:60px;
	margin-bottom:50px;
}
h1 span {
	display:none;
}

Step 9 - Style the Twitter Area

Next we’ll style our twitter box. But before we do, I realised I’d totally forgotten to place my "Follow Me on Twitter" image on the page (silly Collis!) No matter, I’ll add it in now, here’s the resulting HTML code for the area we are working on:

	<img src="images/title_thoughts_nm.jpg" alt="Thoughts via Twitter"/>
    <div id="thoughts" class="content_box">

    	<div id="twitter_div">
            <ul id="twitter_update_list"></ul>
            <a href="http://twitter.com/collis"><img src="images/twitter_nm.jpg" alt="Follow Me on Twitter" /></a>
        </div>

    </div>

Notice that the image appears inside the twitter_div. We’re going to use one of the great benefits of CSS styling to position it so it sits outside of the box. Now if this were the old days and I was making this layout with a <table>, I would wind up using SOO much more code here, setting borders and lots of background images and stuff. Thank goodness for CSS. Here’s our CSS code:

#twitter_div {
	border:1px solid #222830;
	background-color:#101318;
	position:relative;
	min-height:40px;
	padding:40px;
}
#twitter_div img {
	position:absolute;
	bottom:-22px;
	right:-14px;
}

This code turns our twitter_div box into a nice dark box and then positions the <img> inside. Notice that I’ve given the outer twitter_div a relative position. Then on the inside I’ve set the image to an absolute position. Absolute positioning always positions according to the last container with a relative position. If isn’t contained inside any other HTML elements, or none of those elements have a relative position, then it defaults back to the whole browser window.

Because our twitter_div is relatively positioned though, the absolute position will be in relation to that <div>. So in other words top:0px, left:0px, would be the top-left of the twitter_div container. Similarly, bottom:-22px and right:-14px, is measured from the bottom-right of the twitter_div. In this case because we’ve added minus numbers, we’re actually positioning it outside the div.

This is the easiest way to place images that are meant to overlap a box, border, line, whatever.

Positioning can be a bit fiddly to find the exact right number of pixels but you can work it out quickly with a sophisticated technique I call "trial and error" :-)

Step 10 - Style the Twitter FEED

So that’s looking pretty good now, but really not quite what we had in mind. In fact what I originally wanted was the date/time to be on the left hand side, where the bullet points are. And of course the whole thing needs better spacing.

Now because the content is coming from some Javascript which we don’t have any control over, what we need to do is figure out a way to work with what we have. Here’s what we know:

  • Each tweet is in an <li></li> element.
  • The date/time bit is a link, so it must be wrapped in an <a></a> element.
  • And we know that the link is the last thing in each tweet.
  • And we know that links inside of tweets aren’t linked. (I know this because I tried pushing through an actual link and it didn’t appear linked). SO in other words we know that the date/time bit is the ONLY element wrapped in an <a></a>.

So using this information we can apply a style to the <li> and <a> elements to format it how we want. Here’s how we do it:

#twitter_div ul {
	margin:0px;
	padding:0px;
}
#twitter_div ul li {
	list-style:none;
	margin-bottom:5px;
	margin-left:90px;
	font-size:12px;
}
#twitter_div ul li a {
	width:70px;
	display:block;
	position:relative;
	top:-43px;
	left:-90px;
	line-height:19px;
	text-transform:capitalize;
}

Some things to notice about the first two definitions:

  1. The first definition just gets rid of default margins and padding on the <ul> element
  2. Next we get rid of the bullet points (list-style:none). Then we separate the <li> elements with a bottom margin
  3. Then we also tell the <li> elements to have a huge left margin of 90px. This will make enough space for us to move our date/time links into the gap.

The last definition applies to any <a> elements in the list, which is why it was important to check that these date/time links were the only links. First we tell the link to display:block. By setting the link to be a block level element, we stop it from sitting inline with the rest of the text and move it by default to sit below the text as a block.

Now because by default a block element like our link now is, will align to the left, we can say with confidence where the link will be positioned. I.e. that it will be just below our text and aligned to the left. If you want to see what I mean, just delete everything after display:block and look at the result.

With this knowledge, we can use relative positioning to move it relative to where it is now. So we say the link should be 43px higher than where it currently is, and 90px to the left. And this then places the link right where we wanted it! Try it and see!

Complete HTML & CSS

OK! We’re done with our HTML and CSS! You can download the files - images, CSS, HTML - using the link below:

Download Images/HTML/CSS

Step 11 - Testing for Screensize

Now we’re done with our HTML it’s time to do some testing. The first thing to test is how it’s going to look on a 1024×768 screen. I use a Firefox plugin to do this called Firesizer which is just so handy. It appears in the status bar, as shown and you select the screensize and Bam!

Anyhow everything turned out OK so no changes here!

Step 12 - Testing for IE6

Next we test IE6. Because I’m on a Mac, I use a really crappy IE6 solution using something called Darwine. On a PC you can get a standalone install of IE6 that doesn’t tamper with your IE7 install.

If you’re a web developer and you use IE6 by default, you need to stop immediately! hehe. Well I guess there would be cases where it’d be a good idea - e.g. if you were developing for a huge IE6 audience. Still, that’d be pretty weird. I highly recommend Firefox myself, but Opera, Safari, IE8 Beta, even IE7 would be good. Not to mention all the more obscure browsers…

(Note there is an IE7 solution via Darwine too, but as far as I can tell it’s demented … like really crazy and unusable)

Step 13 - Testing for IE7

Now we test for IE7 because although it’s much better than IE6, it can still do the crazies now and again. For this I have to run my newly installed copy of Parallels.

Boy browser testing is laborious!

Still it’s not nearly as labourious as if I’d run into problems! Fortunately it all checked out OK.

Step 14 - Validate Our Markup

And finally because some commenters here are NETTUTS suggested that I really should be validating my markup, we’ll go push it through the W3C validator

Now I know it looks like I have lots of problems there, but in fact they are all coming from the Twitter Javascript - tsk, tsk, tsk, for shame! hehe. So it’s OK, I’m off the hook!

Step 15 - The HTML is Finished! Now to Upload …

And now it’s time to upload. I get out my trusty FileZilla and hook up to collistaeed.com and up goes the site!

With that done … we can turn to CushyCMS!

Step 16 - CushyCMS - Introduction

Now the purpose of this tutorial was really to show you how to use CushyCMS. At least it was until I realised that this is kinda stupidly easy to use and not really worth a tutorial (I learnt to use it from that video they have on their site!)

So anyhow the service is completely free and works by FTPing into your server and modifying the files you tell it to modify. It’s really simple to use as you’ll see, not hugely featured, but it does what it does well. From their homepage it looks like there will be more stuff coming in the future which they’ll be charging for.

I recommend giving it a try as it could be a nice solution for a lot of small client websites, or of course for a site like mine! So anyway, we go to CushyCMS and sign up.

Step 17 - Setup CushyCMS For The New Site

Once you’re logged in, it’s a two step process to get setup:

  1. The first thing to do is Add a Site. This basically just involves giving them the FTP details
  2. Then we Assign Page(s), for us there’s only one, so that’s an easy choice

Step 18 - Adding the CushyCMS Class

Now in order for CushyCMS to know what elements should be editable, we need to specify them in the HTML of the page using a special class definition. So we have to go back to our HTML and add in some class="cushycms" bits.

Now the bits we want to be editable are those <div class="content_box"> areas. But they already have a class= definition. But that’s OK! You can assign multiple classes to a single element by separating them with a space like this: <div class="content_box cushycms">. So the resulting HTML code is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<title>Collis Ta'eed - A Little About Me</title>
	<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
</head>

<body>
<div id="container">

    <h1><span>Hi I'm Collis, entrepreneur, blogger and designer.</span></h1>

	<img src="images/title_about_nm.jpg" alt="About Me" />
    <div id="about" class="content_box cushycms">

    	<a href="/images/collis.tif"><img src="images/photo_sm.jpg" class="photo" alt="Collis"/></a>
	    <div class="about_text">
            <p>After working as a web designer - both employed and freelance - I cofounded a startup with a few friends in 2006.  Our company, <a href="http://eden.cc">Eden</a>, has since grown and I've had the good fortune to work on lots of very exciting and interesting projects, everything from <a href="http://flashden.net">FlashDen</a> to <a href="http://blogactionday.org">Blog Action Day</a>. </p>

            <p>Thanks to the brilliant nature of the web, I'm currently living and working out of Hong Kong and travelling the world. You can find me online on <a href="http://twitter.com/collis">Twitter</a> where I post random thoughts, or you can send me an email from the form at the bottom of this page.  Thanks for stopping by!</p>
		</div>  

        <div class="clear"></div>

    </div>

    <img src="images/title_thoughts_nm.jpg" alt="Thoughts via Twitter"/>
    <div id="thoughts" class="content_box">

    	<div id="twitter_div">
            <ul id="twitter_update_list"></ul>
            <a href="http://twitter.com/collis"><img src="images/twitter_nm.jpg" alt="Follow Me on Twitter" /></a>
        </div>

    </div>

    <img src="images/title_project_nm.jpg" alt="Latest Projects"/>
    <div id="project" class="content_box cushycms">
    	<br />
    	<a href="http://nettuts.com"><img src="images/project_nettuts.jpg" class="photo" alt="NETTUTS"/></a>
        <a href="http://nettuts.com">NETTUTS</a>
		<p>In April Eden launched a sister site to PSDTUTS which I've been working on.  The site hosts web development and design tutorials.</p>
    	<div class="clear"></div>
    </div>

    <img src="images/title_links_nm.jpg" alt="Links" />
    <div id="links" class="content_box cushycms">

    	<p>Some links to sites that I have a hand in:</p>

        <ul>
        	<li><a href="http://flashden.net">FlashDen</a> - Our main Eden project</li>
        	<li><a href="http://freelanceswitch.com/book">How to Be a Rockstar Freelancer</a> - A book I cowrote with my lovely wife</li>
        	<li><a href="http://freelanceswitch.com">FreelanceSwitch</a> - The highly successful blog on freelancing</li>
        	<li><a href="http://psdtuts.com">PSDTUTS</a> - The best photoshop blog around!</li>
        	<li><a href="http://blogactionday.org">Blog Action Day</a> - A nonprofit, annual event</li>
        </ul>  

    </div>

    <img src="images/title_contact_nm.jpg" style="clear:both" alt="Contact Me"/>
    <div id="contact" class="content_box cushycms">

    <p>I'm the first to admit that I'm not very good at answering all my emails, but I do my best and if you have need, then you can <a href="mailto:whoiscollis@gmail.com">email me</a>.</p>

    </div>

</div>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-249823-23";
urchinTracker();
</script>
<script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>
<script type="text/javascript" src="http://twitter.com/statuses/user_timeline/collis.json?callback=twitterCallback2&count=3"></script>
</body>
</html>

Now we go back to CushyCMS and our page is fully editable!

One thing, I should point out is that when I tried to make my Twitter area editable, the CushyCMS system just deleted my empty <ul> element, thereby rendering the Twitter thing unworkable. Unfortunately it seems the editor is a bit too clever for its own good. Still apart from that small annoyance, the system was really not too bad at all. I tend to switch to the Source view when editing, but I can see that clients would find it pretty easy to use. I’m interested to see what things they add in the upcoming paid version.

As a good alternative to this sort of super easy, no coding required, sort of CMS, you could also check out Light CMS which I’ve tried and quite liked too - though it works a little differently.

Conclusion!

So hope you enjoyed the tutorial. Be sure to visit my site, and twitter feed and give the CMS a whirl.

If you know of any other similar CMS products (like Cushy or Light), please leave a comment as it’d be good to do a wrap up of them here sometime.

]]>
http://nettuts.com/site-builds/how-to-build-a-maintainable-site-using-cushycms-and-twitter/feed/
How To Create A ‘Mootools Homepage’ Inspired Navigation Effect Using jQuery http://nettuts.com/html-css-techniques/how-to-create-a-mootools-homepage-inspired-navigation-effect-using-jquery/ http://nettuts.com/html-css-techniques/how-to-create-a-mootools-homepage-inspired-navigation-effect-using-jquery/#comments Sat, 10 May 2008 09:22:32 +0000 Bedrich Rios http://nettuts.com/?p=21 ]]> As you know there are a host of competing javascript libraries around these days. Though I prefer jQuery, I’ve always liked the way the menu on MooTools worked. So in this tutorial we’ll recreate that same effect … but we’ll do it in jQuery!

Step 1

Let’s begin by writing the necessary HTML to create a simple vertical navigation. For the structure, as you may have guessed, we will use an unordered list <ul> with the ID name “sliding-navigation“. Also, we will add some links and give each list item <li> the class name “sliding-element”.

I’m also going to add in a title element. This is a useful thing to do as many WordPress blogs for example have title elements in their sidebar navigation (e.g. "Archives"). So it would look something like this:

<ul id="sliding-navigation">
	<li class="sliding-element"><h3>Navigation Title</h3></li>
	<li class="sliding-element"><a href="#">Link 1</a></li>
	<li class="sliding-element"><a href="#">Link 2</a></li>
	<li class="sliding-element"><a href="#">Link 3</a></li>
	<li class="sliding-element"><a href="#">Link 4</a></li>
	<li class="sliding-element"><a href="#">Link 5</a></li>
</ul>

Step 2

Now, let’s create a HTML document where we can put the work we just did. Create a new HTML file and call it demo.html. Then open this file with your favorite text editor and insert the following code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
	<head>
		<title>Navigation Effect Using jQuery</title>
		<link rel="stylesheet" type="text/css" href="styles.css" />
		<script type="text/javascript" src="jquery.js"></script>
		<script type="text/javascript" src="sliding_effect.js"></script>
	</head>
	<body>
		<div id="navigation-block">
            <ul id="sliding-navigation">
                <li class="sliding-element"><h3>Navigation Title</h3></li>
                <li class="sliding-element"><a href="#">Link 1</a></li>
                <li class="sliding-element"><a href="#">Link 2</a></li>
                <li class="sliding-element"><a href="#">Link 3</a></li>
                <li class="sliding-element"><a href="#">Link 4</a></li>
                <li class="sliding-element"><a href="#">Link 5</a></li>
            </ul>
        </div>
	</body>
</html>

There are a few things to note here:

  1. The !DOCTYPE for our demo.html file is set to XHTML 1.0 Strict. This is not required for the effect to work but I try to get in the habit of using it as much as I can.
  2. You may have notice that the <link> tag is refering to a file called style.css. However, no such file exists. No worries though, that is the next step.
  3. Finally I’ve wrapped my navigation block into a <div>. We’ll make use of this later to position the block on the page.

Step 3

Now that we have our HTML file labelled and working, let’s add some styles. Remember that our HTML document is pointing to a CSS file called styles.css. So, let’s begin by creating a file called styles.css and saving it in the same directory where our HTML document lives. As we did in the previous step, open this file with your favorite text editor and insert the following code:

body
{
	margin: 0;
	padding: 0;
	background: #1d1d1d;
	font-family: "Lucida Grande", Verdana, sans-serif;
	font-size: 100%;
}

ul#sliding-navigation
{
	list-style: none;
	font-size: .75em;
	margin: 30px 0;
}

ul#sliding-navigation li.sliding-element h3,
ul#sliding-navigation li.sliding-element a
{
	display: block;
	width: 150px;
	padding: 5px 15px;
	margin: 0;
	margin-bottom: 5px;
}

ul#sliding-navigation li.sliding-element h3
{
	color: #fff;
	background: #333;
	border: 1px solid #1a1a1a;
	font-weight: normal;
}

ul#sliding-navigation li.sliding-element a
{
	color: #999;
	background: #222;
	border: 1px solid #1a1a1a;
	text-decoration: none;
}

ul#sliding-navigation li.sliding-element a:hover { color: #ffff66; }

Step 4

At this point your demo.html page should be looking something like this:

Demo Preview

So, it is finally time to begin using jQuery. But before we can get started we need to do a few of things:

  1. Download the latest version of jQuery.
  2. Create a new file called sliding_effect.js and save it in the same directory as that of your HTML and CSS file.
  3. Lastly, insert the two previous files to your HTML document’s <head>.

This is what your HTML file’s <head> should look like now:

	<head>
		<title>Navigation Effect Using jQuery</title>
		<link rel="stylesheet" type="text/css" href="styles.css" />
		<script type="text/javascript" src="jquery.js"></script>
		<script type="text/javascript" src="sliding_effect.js"></script>
	</head>

Step 5

Now, we will create the function that will do all the “heavy” lifting for the sliding effect to work. This function will take five parameters (navigation_id, pad_out, pad_in, time, and multiplier) and use them as follows:

  1. navigation_id: This is the ID name of the navigation, which contains the elements the effect will be applied on.
  2. pad_out: This is the number of pixels to be padded left when one of the links inside the navigation is hovered.
  3. pad_in: This is the number of pixels to be padded left when one of the links inside the navigation is no longer being hovered.
  4. time: This represents the amount of time (in milliseconds) that takes for one of the link elements to slide in and back in to place when the page is loaded.
  5. multiplier: The job of the multiplier is to increase or decrease the amount that takes the a following link element to slide in to the screen. In other words, if the multiplier is 1, all link elements will slide in to the screen in equal time intervals. However, if it is less than 0, the subsequent link elements will slide in faster, and if it is more than 1 the opposite will happen.

So, open your sliding_effect.js file and insert the following code:

function slide(navigation_id, pad_out, pad_in, time, multiplier)
{
	// creates the target paths
	var list_elements = navigation_id + " li.sliding-element";
	var link_elements = list_elements + " a";

	// initiates the timer used for the sliding animation
	var timer = 0;

	// creates the slide animation for all list elements
	$(list_elements).each(function(i)
	{
		// margin left = - ([width of element] + [total vertical padding of element])
		$(this).css("margin-left","-180px");
		// updates timer
		timer = (timer*multiplier + time);
		$(this).animate({ marginLeft: "0" }, timer);
		$(this).animate({ marginLeft: "15px" }, timer);
		$(this).animate({ marginLeft: "0" }, timer);
	});

	// creates the hover-slide effect for all link elements
	$(link_elements).each(function(i)
	{
		$(this).hover(
		function()
		{
			$(this).animate({ paddingLeft: pad_out }, 150);
		},
		function()
		{
			$(this).animate({ paddingLeft: pad_in }, 150);
		});
	});
}

Step 6

All we need to do in order to trigger the script is call the function when the page has loaded. There are two place to put the following snippet of code. It can either be written inside the sliding_effect.js file (I chose this option for this tutorial) or called within the HTML using a <script> tag. Either case will use the same code, which is as follows:

$(document).ready(function()
{
	slide([navigation_id], [pad_out], [pad_in], [time], [multiplier]);
});

Step 7

Finally we’ll add a bit of style to the page to make it look slightly more glamourous. First I’ve created an image block that looks like this:

The image has a faint gradient, a highlight line, is 190px wide and called “background.jpg”. The idea will be to position this to the left of our navigation so that the buttons slide in under it. We’ll also add a little heading title to the page. So our HTML becomes:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
	<head>
		<title>Navigation Effect Using jQuery</title>
		<link rel="stylesheet" type="text/css" href="styles.css" />
		<script type="text/javascript" src="jquery.js"></script>
		<script type="text/javascript" src="sliding_effect.js"></script>
	</head>
	<body>
		<div id="navigation-block">
        	<img src="background.jpg" id="hide" />
            <h2><span>Navigation Effect Using jQuery</span></h2>
            <p>By Bedrich Rios</p>
            <ul id="sliding-navigation">
                <li class="sliding-element"><h3>Navigation Title</h3></li>
                <li class="sliding-element"><a href="#">Link 1</a></li>
                <li class="sliding-element"><a href="#">Link 2</a></li>
                <li class="sliding-element"><a href="#">Link 3</a></li>
                <li class="sliding-element"><a href="#">Link 4</a></li>
                <li class="sliding-element"><a href="#">Link 5</a></li>
            </ul>
        </div>
	</body>
</html>

Notice that I’ve added the image inside the "navigation-block" element and give it an ID called "hide". Also I’ve added a heading element and subtitle. Now we add a bit of extra CSS to our styles.css file as follows:


h2
{
	color: #999;
	margin-bottom: 0;
	margin-left:13px;
	background:url(navigation.jpg) no-repeat;
	height:40px;
}

h2 span
{
	display: none;
}

p
{
	color: #ffff66;
	margin-top: .5em;
	font-size: .75em;
	padding-left:15px;
}

#navigation-block {
	position:relative;
	top:200px;
	left:200px;
}

#hide {
	position:absolute;
	top:30px;
	left:-190px;
}

So first in the <h2> element, we have set the HTML text to vanish using "display:none" and set a background image of some nicer looking text I prepared earlier.

Also notice that the "navigation-block" element now has a relative position, so that we can move the "hide" image over to the left. This will make the tabs appear from under it.

Lastly to give our tabs a bit of finish I’ve added a subtle background image that looks like shading like this:

ul#sliding-navigation li.sliding-element h3
{
	color: #fff;
	background:#333 url(heading_bg.jpg) repeat-y;
	font-weight: normal;
}

Finished

And we’re done!

View the Final Effect

Download the HTML/Images/JS

]]>
http://nettuts.com/html-css-techniques/how-to-create-a-mootools-homepage-inspired-navigation-effect-using-jquery/feed/
Use Amazon S3 & Firefox To Serve Static Files http://nettuts.com/misc/use-amazon-s3-firefox-to-serve-static-files/ http://nettuts.com/misc/use-amazon-s3-firefox-to-serve-static-files/#comments Thu, 08 May 2008 02:05:18 +0000 Collis Ta'eed http://nettuts.com/?p=20 ]]> Hosting services have gotten a lot better in recent times, more storage, more bandwidth, cheaper prices. But there is only so far that regular hosting will go. When I first launched PSDTUTS, despite being on a great webhost with some big specs, we ran into both bandwidth and file serving problems when our tutorials (each containing dozens of heavy images) would land on Digg. And then a friend recommended I try using Amazon’s Simple Storage Service (aka S3).

It turned out to be really easy to use S3 like a giant, unlimited host, and I’ve been using it ever since for high-access, or heavy files like podcasts for FreelanceSwitch, images for blogs, and even for sending files to clients. In this tutorial I’ll show you how with just Firefox you can turn S3 into your own personal content delivery network.
It’s super simple, even I could do it!

Step 1

The first thing you are going to need is an account. So do the following:

  1. Log in to your regular Amazon.com account (or if you don’t have one, create one!)
  2. Go to Amazon.com/AWS (AWS = Amazon Web Services)
  3. Using your Amazon account, Create an AWS account by following the prompts
  4. When you’ve created your AWS account (shown below) you’ll see a list of web services that you might be interested in. Choose "Amazon Simple Storage Service"

Step 2

Now before you can do anything with S3 you have to Sign Up For This Web Service. (I know there’s a lot of signing up to do!)

You’ll need to provide a credit card so that Amazon can bill you for bandwidth, storage and processing. The rates are low, something like $.15 p/gb transferred.

Although you might be thinking that your webhost provides bandwith at a much cheaper rate, this probably isn’t really the case. For example a company like Dreamhost will offer you literally terrabytes of bandwidth for just a few dollars a month. However if you try to hit their servers quickly to make use of this bandwidth (e.g. during a Digg, or when you just sent a newsletter out about a download file), you’re unlikely to get either a quick download, or even a download at all. In my experience webhosts count on the fact that there are a lot of factors that ensure it’s highly unlikely you’ll ever use that bandwidth.

In the time I’ve used S3 - about 8 months now - I’ve hit it with some pretty large spikes of traffic. The biggest was a day when we had 150,000 visitors in a single day on a tutorial with a total of 3mb of images. So that day alone it served up 450gb of data, and didn’t even bat an eyelash. I’m sure in the scheme of things there are much bigger users too.

So it’s pretty safe, and it’s pretty cheap. Meanwhiles Amazon should really be paying me money for all this promotion :-)

Step 3

So anyway once you’ve signed up, click on the "Your Web Services Account" button and a little menu appears. This is where you control your account, check on your activity (ie. bill) and so on.

Click on "AWS Access Identifiers"

Step 4

Now you’ll get two numbers, your access key ID and your secret access key. Needless to say you want to keep these very safe!

Copy the two numbers out into a text editor so we have them on hand, because we’ll need them in a second.

Step 5

Next we’re going to need our Firefox Extension. If you’re not using Firefox … well you’re on your own :-) I know for example you can use Transmit on a Mac to log in to your S3 account. Presumably on Windows there is something similar (if anyone knows … please do leave a comment).

So we’re going to use the S3Fox extension from RJonna

Visit the website and click on the link shown in the screenshot to download S3Fox.

Step 6

Once installed, your Firefox will restart and then you’ll see that you can now access S3Fox either from the bottom right of your browser window or from the Tools menu.

So go to Tools > S3 Organiser and you should have a tab appear showing your S3Fox window. It’s really similar to an FTP program and hence super easy to use. There are a couple of differences though.

So click on Manage Accounts and create an account with your Access Key and Secret Key from earlier. Click Save.

Step 7

Once you’ve created an account you’ll get a blank area on the right hand side. The first thing you need to do is create a Bucket. A Bucket is Amazon terminology for what amounts to a folder or directory of files. Bucket names have to be unique across the service, so for example you won’t be able to create a bucket called "Test" because I’m sure that was like the first bucket name to go.

Anyhow right click on the right hand side and choose "Create Directory", this will in fact create a Bucket because we’re in the root. Once you have a bucket created you can create directories inside. You can also have as many buckets as you wish.

You’ll be prompted for a name and the extension will show you a bunch of rules about bucket names. Weirdly the extension seems to interchange the words bucket, folder and directory.

Step 8

So I created a bucket named "nettuts" and then added two directories inside called "003_S3" and "s3demo". Then I have dragged an image over to upload to S3. The image is called s3image.jpg.

Now Right-Click on the file and choose Edit ACL. Before you can access your file you’re going to need to change its permissions, and that’s what this does.

You’ll be prompted to give Read/Write/Full Control by ticking or unticking some selections. You only want to give Read access here, so tick the boxes.

(Note on a Mac the extension has a weird bug that when you click on the ‘x’ it doesn’t immediately change to a tick, but when you click Save, all of a sudden it does. It’s confusing and hopefully will get fixed, but you get used to it)

Step 9

Now once you have set permissions, Right Click again and choose Copy URL to Clipboard. The URL For my image is:

http://nettuts.s3.amazonaws.com/003_S3/s3demo/s3image.jpg

As you can see the first part of the URL is the bucket name, then the domain, then the folders and finally the file name.

That’s It!

And that’s it, here’s the image that I placed on S3. Right click and view its location to see! (Actually all the images in this tutorial are on S3 :-)

Of course if you want to do all this dynamically with PHP or Ruby, that’s a whole other kettle of fish, and hopefully one we’ll cover here in future. You can also get Wordpress and other app plugins that connect up to S3.

]]>
http://nettuts.com/misc/use-amazon-s3-firefox-to-serve-static-files/feed/
Contributions Open, Traffic Steady & Other News http://nettuts.com/news/contributions-open-traffic-steady-other-news/ http://nettuts.com/news/contributions-open-traffic-steady-other-news/#comments Tue, 06 May 2008 01:38:47 +0000 Collis Ta'eed http://nettuts.com/?p=19 ]]> It’s two weeks since NETTUTS launched and I’m happy to report the site is kicking along better than I ever expected! With two and a half thousand RSS readers and some eight thousand visitors a day, it’s kinda staggering for a brand new site!

With such booming progress I’ve been knuckling down to get the mechanics of the site working a little better and have plenty of news to tell…

Contributions Open

The big news is that you can now contribute a tutorial to NETTUTS! I’ve created a contribute form and set a reward of $150 for any published tutorial. There are guidelines on the sorts of things we’re looking for over on our Contribute a Tutorial page.

The main criteria will of course be tutorial awesomeness! And so far some applications have already started appearing. I’ve also got emails from some potential regular writers courtesy of a job ad I placed up a few weeks ago. So this week we should see the first content from someone other than me, yay!!

Ads on Sale

I also placed NETTUTS up on BuySellAds to sell ad spots to help pay for contributions, and happily we’ve already sold two spots!! Be sure to pay a visit to both Studio7Designs and PSD2HTML for sponsoring the site so early!

Happily with our steady traffic flow, I’m confident that we should win some more advertising spots over the coming weeks and this site will get to steady publish schedule much faster than I’d originally thought!

I Bought Parallels / WinXP

In my first couple of tutorials I didn’t have any way to test Internet Explorer and there were a couple of browser compatibility issues. Happily yesterday I went out and got Parallels/XP so I’m going to go back and add a footnote to them to fix those.

Also this got me to thinking about how the sum of the knowledge of the community is much greater than an individual writer. Certainly I’ve been learning quite a few things from the comments on the site. So I’m going to figure out a way to take some of the better comments on alternate ways or fixes to a method, and add them to the end of the tutorials to improve them.

Onwards and Upwards

So that’s it for the moment. Still getting things ship shape here, but so far so good! If you have any suggestions on site improvements, do feel free to comment them in. And of course we also have our place to comment in tutorial suggestions for writers.

Thank you everyone for all the support, links and comments. I have the best job in the world :-)

]]>
http://nettuts.com/news/contributions-open-traffic-steady-other-news/feed/
7 Crucial Tips for Designing and Maintaining a Large Site http://nettuts.com/articles/7-crucial-tips-for-designing-and-maintaining-a-large-site/ http://nettuts.com/articles/7-crucial-tips-for-designing-and-maintaining-a-large-site/#comments Fri, 02 May 2008 08:19:23 +0000 Collis Ta'eed http://nettuts.com/?p=18 ]]> Projects vary in scope and size, and the challenges they entail vary likewise. As a lone web designer, the biggest job I am responsible for is FlashDen. Along with thousands of active members all chatting, uploading and buying, the site processes large amounts of money and large amounts of traffic.

Designing, redesigning, maintaining and working with developer team has given me some useful insights and tips for making life easier. And since today we’ve launched my latest redesign of the site, it seems like a good time to write up my top 7 tips!

1. Design and Code for Maintainability

The first and biggest tip I can give, is to design the site so that it’s easy to maintain. Often times when designing a site you might sacrifice things for aesthetics. For example you might use images where text or styles would suffice. Or you might deliberately choose a menu structure that has no room to grow. When the site is large, this becomes a really bad idea.

When I built the very first version of FlashDen almost two years ago, I used images for buttons. They looked really nice, but I wound up with a library of 100 different button images, not to mention rollovers. Then in the next couple of months every time a developer needed a new button they had to ask me to create an image. Needless to say I learnt that lesson pretty quick and we switched to a single button class that maybe doesn’t look as good, but is much better for peace of mind.

Another aspect of maintainability is thinking about how the site is going to grow and change. For example, as new pages get added on, where do they go? Early on I wanted to have a horizontal navigation, but this is really limited After some experimenting, we wound up using a vertical nav, allowing for submenu items, and then on top of that, added a tab structure into pages to allow for related pages to be grouped together. I’m not saying it’s the best navigation in the world, but it certainly means we’re not redesigning every time a new section is added to the site!

So in designing for a large site, look for ways to make life simpler later, because you’ll be glad you did!

2. Figure out your User Groups and Tasks

One of the biggest differences between a large site and a small one, is the number of different user types who might be using the site. For example on FlashDen, there are buyers, authors, visitors, admins, and members. Each group has a different set of aims and tasks they have to carry out. Sometimes these tasks overlap, but sometime they are quite different.

The best example of a place where user tasks are at odds with each other is on a homepage. Nowhere else on a site does every user group converge, and nowhere else is it so vital to make sure everyone gets what they want. And of course you have to be careful that in serving one user group you aren’t ignoring another.

In this latest redesign of FlashDen, the biggest area that I worked on was the homepage. The first thing I did was list out to myself all the things that each user group needs to do:

  1. Buyers - People who are on FlashDen to purchase files
    Start browsing items, start searching, access their personal homepage, deposit money, learn how the site works (for newer buyers)
  2. Authors - People who are selling goods on FlashDen
    Chat with other members, get featured on the homepage to push their items, find out about site news, quickly get to their portfolio & earnings
  3. New Visitors - Potential Buyers/Authors/Members, who have just arrived
    Learn what the site is/does very quickly, get started, find out types of files and prices
  4. Members - People who aren’t really buyers or authors, but just participate in the community
    Chat with other members, see site news, browse files
  5. Admins / Reviewers - Our staff who manage file approvals, moderate forums, and generally participate
    Get quickly to file approvals, see the latest forum threads, hear site news

When you know what different user groups want to do, then you can design a page that solves all their needs. Needless to say this is a task that gets exponentially harder the more groups and tasks there are. On other pages in the site, you will often get a subset of user groups to worry about, but on the homepage they all converge. Not coincidentally, the homepage is the most important bit of design work you have to do on a site.

Before you can solve the different needs though, you need to prioritize the user groups, and in order to do that, you’ll need to understand what the site is trying to achieve.

3. Understand the Site Goals

Although every user group naturally feels they are the most important, it is up to you to prioritize them according to what the site itself is trying to achieve. For example on FlashDen after sitting down with the team we drew a few conclusions as follows:

  • The top priority for the site is to serve buyers. When buyers are served well they keep buying bringing income and simultaneously serving the authors.
  • It’s vital to get new visitors to quickly learn about the site and hopefully become members. FlashDen is still in a relatively new market, and new competitors are still appearing, so that makes it more important to capture visitors and convert them to buyers or authors or members.
  • Authors are important because at its heart FlashDen is really about her authors, but out of all the user groups they are the most committed to the site.
  • Members are not as important as Authors and Buyers, but do contribute to the community surrounding the site.
  • Admins / Reviewers are the least important as they are a paid group.

So following from this, it’s possible to conclude that the homepage needs to server users in this order: Visitors > Buyers > Authors > Members > Admins.

Understanding what your site is trying to achieve is the final thread that sews your user tasks together and tells you what you should be trying to put on the page. Ideally on every key page you should identify the user groups, tasks and priorities. For a vital page like the homepage I do this formally on paper, and for lesser pages I will often just do it in my head while designing.

4. Design, Refine, Refine, Refine …

It’s only after you’ve figured out user groups, tasks, site goals, priorities and so on, that it’s time to design! It is really vital that you do this first, because on a practical level, it dramatically lowers the odds that you are going to have go back and redo your design. Whenever I have just started designing a big site, without really analysing first, I have inevitably had to rework lots of screens or even whole interfaces.

Lots of designers like to use wireframes at this point - that is to simply lay out a bunch of lines and boxes indicating roughly where things should go. Personally I prefer to work in Photoshop from the start because I’m quick enough and it lets me really see what’s going to happen. I also think that there is more to information design than where something appears on a page. Simply altering colours and background colours can make a page element further down the page suddenly seem more important.

Once you do have a rough idea of how the information needs to work together, you should come up with a working design that is generally OK, and then refine, refine, refine. I often will wind up with 5 or 6 versions of the same look, where I’ve tried varying different things like type sizes, images, layout alterations, backgrounds, and so on, to see how it affects the information you’re presenting.

No matter how good you think the first layout is, I can guarantee that after spending more time and coming up with more versions you’ll have discovered that your original wasn’t quite as good as you first thought. Sometimes you wind up throwing out the whole design and starting again, but if you do have a good base, then refining should get you to a great finish.

5. Get Others’ Opinions, but Make the Final Calls

In any large job you are going to have a lot of other opinions involved. In most cases these will be the opinions of your client. Prior to starting FlashDen, I used to work with all sorts of companies building websites. Among them I did have the misfortune to design for several large insurance companies and a few governmental organisations. I say misfortune because when you get to that size of client you are dealing with a lot of stakeholders, and in many situations it isn’t clear where the real power to make decisions lies. This can result in endless meetings, endless changes and a high degree of difficulty for carrying through your vision.

Whatever the client, it’s really important to get their opinions. Aside from anything else in most cases they know a lot more about the business than you do. Hopefully they also know more about the users than you do, and with this knowledge will be able to give constructive advice.

It’s also important to get the opinion of the development team you are working with. At FlashDen we’re fortunate to have two devs who have a lot of skill in user interface design and usability. And their input, along with the rest of the team, made a lot of difference to the end product.

But in the end, it’s up to you as the expert designer to come up with the final call. If you have a tough client this can be tricky, because a client often believes they should make the final calls. If that is the case, you need to (a) find ways to explain, educate and show the client that your choices are for their benefit; and (b) sometimes bite the bullet and accept the client’s directives as a further constraint in your project, and find ways to make it work.

6. Organise for the Future

When you are coding up a design for a big site, it’s really important to again think about the future. How you manage your files and folders will impact you greatly later. For example recently we have decided to build a sister site to FlashDen that focuses on audio only called AudioJungle. To make things simpler the site is going to run the same HTML, with just stylesheets to make it look like a different site. A development like that throws up all sorts of new challenges to my file and folder structures, my stylesheets and my HTML. Here are some things to keep in mind:

  1. Organise yourself into a good folder structure
    Scripts, stylesheets, interface images, content images, and so on, all need to be kept separately. With a small site you might be able to just dump things together, but the bigger you get the more important it is to be able to find what you need.

  2. Use a coherent and intelligent naming system for your files
    There’s nothing worse than looking at a pile of images with names like "gd_l3.jpg". How you do it is largely a personal matter, but I find naming using common prefixes and descriptive file names helps a lot. So for example I might start every image going in the header with the word ‘header_’, every background with ‘bg_’ and then a menu background from the header would be called ‘header_bg_menu.jpg’. Prefixes have the advantage that when your files are sorted by name, they all appear together.

  3. Use Subversion
    This was forced on me by our developers, but thank goodness it was! Subversion tracks files and file changes and stops you from overwriting other designers/deveopers working on the same project. Also importantly it helps you roll back to old versions of things. It takes some getting used to, but even minus all the reasons developers use it, it’s worthwhile for HTML/CSS designers. Don’t know about Subversion? Check out Subversion for Designers

  4. Be thoughtful about how you write your HTML and CSS
    It’s really easy to make a mess with your HTML and CSS files, and it’s really hard to clean them back up. After four redesigns, I’m still using many of the same CSS files and it is a mission cleaning up classes that aren’t used any more or finding obscure definitions wrapped in lots of layers. Use lots of comments, possibly even multiple stylesheets, and make sure you name your styles well!

  5. Get Browser Compatibility working EARLY
    This is an area I went really wrong with FlashDen and we’ve been paying for it ever since. My initial layout worked in IE7 and I ignored IE6 until after we’d finished building the whole site. Ever since we’ve been adding IE conditionals, and hacks and workarounds. It’s much easier to make something compatible when there are only a few elements on the page than when you’ve built a massive site, so don’t follow my foolishness!

7. Make it Easy to Develop With Your Stylesheet

The bigger the site, the less likely a designer will get to see or modify every single page. If you’re a single designer on a big site - like me - then you also might not want to be called in for every thing. So it pays to make a stylesheet that can almost by default makes things look nice. For example:

  1. Make sure you style default elements like <input>, <strong>, and so on.
    That way the page will automatically present well. If you rely on people doing things like <strong class="my_bold"> then inevitably you’ll wind up with variance on pages.
  2. Create reusable elements that developers can use.
    For example on FlashDen we have a table class called "general_table", that makes a good fall-back style for data. When I have a chance to style a page I can do more specific types of tables and data highlighting, but at the very least a developer putting together a page has a good all-round table style to use.
  3. Make sure your page layout has a structure that looks nice even when it’s just got text in it.
    Inevitably there will be pages which you haven’t had a chance to add images to, and which may look a little boring. By using things like heading styles, sidebars, and so on, you can make sure that they still look pleasant and have some visual style. For example on FlashDen we wrap most text blocks in:

    <fieldset>
    <legend>Heading</legend>
    Content
    </fieldset>

    And this by default wraps the text up with a nice little border around it and a heading. It’s easy for a developer to work with and does a good job of separating text up and making it look more readable. We also have a sidebar component which is just another package for extra text content, but that again makes the page look more visual.

Naturally it’s optimal if every page does go through a designer, but it’s also much less stressful knowing that even if they don’t, it’ll still look professional and uniform.

What’s your opinion?

So those are my tips, if you have some of your own from working on bigger sites, leave a comment!

]]>
http://nettuts.com/articles/7-crucial-tips-for-designing-and-maintaining-a-large-site/feed/
Best of the Web - April http://nettuts.com/web-roundups/best-of-the-web-april/ http://nettuts.com/web-roundups/best-of-the-web-april/#comments Thu, 01 May 2008 02:40:03 +0000 Collis Ta'eed http://nettuts.com/?p=17 ]]> While naturally in my totally unbiased opinion, the best thing to happen on the web in April was the launch of NETTUTS, there is of course tons of great content out there. I’ve put together some of my picks of the best things to pop up during April …

HTML + CSS + Javascript

  • The Highly Extensible CSS Interface

    April saw Cameron Moll finish off his extensive series on developing an interface using CSS and jQuery with the final post - Testing for Extensibility.

    View the Whole Series

  • Build a Horizontal Sliding Tabbed Archive with jQuery

    Last week we ran our tabbed navigation tutorial, Sam Lu has his own jQuery tabbed nav tutorial which has content sliding in from left and right. Neat effect!

    Visit Tutorial

  • 30 Exceptional CSS Techniques and Examples

    I love a good roundup and SixRevisions is only too happy to provide them! Make sure you flick through their archives and see all the other neat lists they have.

    Visit Article

  • This is How you get sIFR to Work

    sIFR - the Flash/HTML technique to get custom fonts on your page - might look tricky to use, but with the aid of this walkthrough, it’s a piece of pie!

    Visit Tutorial

  • 4 Uber Cool CSS Techniques for Links

    CSSGlobe is one of my favourite sites for great snippets of CSS and they don’t let you down with this great post!

    Visit Tutorial

  • Better Pull Quotes: Don’t Repeat Markup!

    CSS Tricks has a neat bit of technique to use so that you don’t have to have two blobs of the same text on your page to make a pull-quote. It makes use of jQuery to achieve the result and is quite simple to achieve!

    Visit Tutorial

  • Reset Stylesheets

    CSS newbie walks you through why and how reset stylesheets work, along with a couple of links to some more popular ones.

    Visit Article

  • Image Fades using jQuery

    The latest tutorial from jQuery for Designers shows us how to fade images into each other using … you guessed it jQuery!

    Visit Tutorial

  • 6 Most Important CSS Techniques You Need to Know

    A bunch of useful CSS tips to take to heart, certainly taught me a couple of things!

    Visit Tutorial

  • Improve Form Usability with Auto Messages

    One of my favourite blogs - Woork … who doesn’t love that picture of Antonio? :-) - has published a neat little tutorial on adding a little message using Scriptaculous.

    Visit Tutorial

  • MarkItUp

    Turn any textarea into a markup editor. Html, Textile, Wiki Syntax, Markdown, BBcode or even your own Markup system … Can’t wait to test this out, looks very cool! (Via WebResourcesDepot)

    Visit Site

Flash!

  • Build a Parallax Gallery

    Nick La of WebDesignerWall takes you through building a horizontal scrolling environment using alternating scroll speeds to give it a 3d-esque feel. You can also find a neat Parallax extension for sale over at our sister site FlashDen.

    Visit Tutorial

  • Making an MP3 Player in AS3

    The design may not be too attractive, but this is still a handy tutorial on using AS3 to put together a little MP3 player …

    Visit Tutorial

  • Getting Started with Flash

    Looking for a solid introduction to Flash? Look no further than Carlos’ great little intro.

    Visit Tutorial

  • Creating an XML Slideshow (Actionscript 2)

    XML Slideshows are the bomb and this tutorial will walk you through creating a simple fading slideshow using Actionscript 2.

    Visit Tutorial

  • Non-AS Photo Presentation

    Don’t want to use Actionscript to make your image slideshow? Try this basic masking tutorial that produces a nice effect.

    Visit Tutorial

  • Object Oriented Scrollbar

    Flash tutorial master Lee Brimelow released a new two-part video tutorial on creating a scrollbar, watch them at GotoAndLearn …

    Visit GotoAndLearn

Content Management Systems

  • Build an Expression Engine Site From Scratch

    OK so this didn’t technically happen in April, but I found it in April so it kinda counts! Anyway if you’ve ever wanted to play with Expression Engine then this is the tutorial for you. It’s really long, so long it’s become a book that you can purchase from Lulu if you’d like your tutorial in the convenience of paper and ink. Definitely worth checking out!

    View the Whole Set

  • Blog Perfume - Wordpress

    This isn’t so much something that happened in April as just an awesome WordPress site that I’ve been meaning to link up for ages! Created by Ray of WebAppers it’s a great resource for WP junkies.

    Visit Site

  • Cushy CMS

    I’m not 100% sure if Cushy just launched, but certainly it only just popped up on my radar during April. Looks like a promising CMS, definitely worth checking out.

    Visit Site

  • An Introduction to Movable Type Templates

    DevLounge brought us not one but two useful MT tutorials with the introduction and also Anatomy of a Movable Type Template

    Visit Tutorial

  • Powerful List of WordPress Plugins

    Noupe does one of their gigantic lists, this one on WordPress plugins, plenty of ones I use regularly in there! In case you’re wondering that screenshot is of Fluency - an alternate WP-Admin skin. Nice!

    View the List

  • WordPress Template Heirarchy Diagram

    Michael from WPCandy has done over WordPress’ diagram of the template heirarchy to give it a bit more visual edge, nice job Michael!

    Visit Article

Miscellanea

  • 10 Common Mistakes in Redesign

    I hate to say it but I’m guilty of quite a few of these mistakes - especially "Launching before the new design is cross-browser tested" :-) That’s my achilles heel!

    View Article

  • Five More Principles Of Effective Web Design

    Continuing on from their 10 Principles of Effective Web Design Smashing Magazine gets us to 15 solid foundations for good web technique. Speaking of principles of web design, you might want to check out the article I wrote back last year on PSDTUTS - 9 Essential Principles of Good Web Design. Now that’s a lot of principles to read about!!

    Visit Article

  • Build an AIR application using Dreamweaver CS3

    Jonathan Snook of Snook.ca writes up this simple introduction to making an AIR app using the Adobe AIR extension for Dreamweaver.

    Visit Tutorial

  • Getting Started with Ruby on Rails

    In their latest edition AListApart has been posting on getting going with the ubiquitous Ruby on Rails with both Getting Started and Creating More Using Less Effort

    Visit Tutorial

  • The Web Developer’s SEO Cheat Sheet

    SEOMoz is my favourite place to go for SEO advice and this neat little PDF checklist is a handy little download for forgetful web devs.

    Get the PDF

  • Subversion for Designers

    I use subversion when working on the FlashDen codebase and I have to say it will really help your productivity and workflow if you are working on big projects. I’ve yet to try using it on my regular work but am planning to soon! In any case this is a great introduction…

    Visit Article

  • Developing with Google App Engine

    This month Google launched their new App Engine product, a cloud service for running Python apps. If you’re looking for an introduction, ThinkVitamin’s got a good one…

    Visit Tutorial

  • Planning a Semantic Website

    The "Semantic Web" is meant to be the next phase of the web, and IBM has a long article about planning a website focussed this way. I must admit I didn’t make it through the whole article, but if you’re looking to get the jump, I’m sure it’s worth it!

    Visit Article

  • 101 AIR Resources to add to your toolbelt of Awesomeness

    You know I love 101 lists, but I never get through them. Still here’s one for all you AIR junkies to bookmark away.

    Visit List

]]>
http://nettuts.com/web-roundups/best-of-the-web-april/feed/
Build a Sleek Portfolio Site from Scratch http://nettuts.com/site-builds/build-a-sleek-portfolio-site-from-scratch/ http://nettuts.com/site-builds/build-a-sleek-portfolio-site-from-scratch/#comments Sat, 26 Apr 2008 05:11:46 +0000 Collis Ta'eed http://nettuts.com/?p=16 ]]> There’s nothing like building an entire site to show you a good overview of how a CSS layout should work. Over at PSDTUTS we’ve got a tutorial where you design up a sleek, high end web design. In this tutorial we’re going to take that PSD file and build it with some nice clean HTML and CSS.

Step 1

So here’s the design we’re going to be building. As mentioned you can follow the tutorial over at PSDTUTS to build this design from scratch. In this tutorial we’re only going to build this homepage, however using that as a base you would be able to build interior pages following the same layout.

Step 2

The first thing to do is decide how we are going to structure our build. This process gets easier over time as you learn how CSS layouts can work. For this design I think we can get away with a very simple build which uses quite a bit of absolute positioning and a large background image.

What is Absolute Positioning?
When you place an HTML element on a page (e.g. a <div>, <p> and so on) it has a natural position which is determined by what came before it. So for example if you put a <p></p> down with some text in it, and then you place another <p></p> it will naturally appear just below the first <p>. It will just flow on relative to the last element.

Absolute positioning is different in that you are specifying an exact placement for an object and taking it out of the regular flow of elements. So if you had your first <p></p> just as before, but for your next <p></p> you gave it an absolute position of left:500px; top:500px; Then it would appear precisely in that location regardless of the previous <p>.

You set the absolute position of something like this:


.className {

	position:absolute;
    top:0px;
    left:0px;

}

Drawbacks to Absolute Positioning

The main problem with using absolute positioning is that your elements don’t really relate to one another. So for example if you have one block of text near the top of your page, and another block of text a bit further down, it might look great when each block of text is short. But if the top block were to have a big essay in it, then instead of pushing the next block of text down, it will just go over the top. This is because you are taking the elements out of the natural flow of the page.

So Absolute Positioning is only really useful for objects that you know will always be a certain size, and which don’t really need to interact with other elements.

Why it’s useful to us today
The good thing about Absolute Positioning, is that it’s really, really easy! You tell the browser where to put something and that’s where it appears! To top it off, there are far fewer browser compatibility issues when you position things absolutely. After all 100px is 100px whether you’re in Firefox, Internet Explorer, or Safari.

SOOO our layout
So the way we are going to make our website is:

  • Have a large background image
  • Absolutely position the logo, menus, and heading panel precisely where they are meant to appear
  • Have all our content appear in a regular <div> tag, but give it so much padding-top that the content is pushed all the way down to where it’s meant to be
  • Have our footer sitting underneath

If that doesn’t make a whole lot of sense yet, don’t worry it will as you see the site take shape!

Step 3

Now in terms of background images, we need two. One is going to be gigantic, and in fact after I saved it as a JPG it is about 56kb in size. There used to be a time where that would have been a bit too big, but these days it’s not a big deal.

So that’s the main area, then we need a second background image which will be a thin slice. This slice will repeat over and over off to the right so that when the browser window is dragged open it tiles out.

(Note the logo shouldn’t be showing below in the background image, that was just some bad screenshotting, sorry!)

You can see the two images I’ve created here and here.

Step 4

OK so now let’s start our HTML. First we lay out some basics:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<title>PSD vs NET</title>
	<link rel="stylesheet" href="step1_style.css" type="text/css" media="screen" />
</head>

<body>
<div id="outside_container">
	<div id="container">

		<!-- The Main Area -->

	</div>
</div>
<div id="footer">

	<img src="images/footer_logo.jpg" />

    <span id="footer_text">
        Made for a PSDTUTS and NETTUTS tutorial by Collis!
        See the <a href="http://psdtuts.com">Photoshop Tutorial</a>,
        see the <a href="http://nettuts.com">Web Tutorial</a>
    </span>

</div>
</body>
</html>

As always it’s best to work from the outside in with our layout. So what I’ve done here is place three major <div>’s. The first two are the outside_container / container and the other is the footer. This requires a little explaining:

  1. I’ve created the outside_container and container because I need a double background image. That is I need a tiling background image, and then on top of that I need that large background image. So in the outside_container I’ll place the tiling background, then on the container <div> which will appear on top of the outside container, I’ll have that big main background.
  2. The footer needs to be outside the containers because if the browser window were stretched lengthwise, the footer should go on and on. Since it has its own background, it can’t be in the containers - if it were and you stretched at some point you’d see the container background and not the footer!

Also you’ll see I’ve added some content inside the footer, that’s just the mini logo, and the text. I’ve wrapped the text in a <span> tag so that I can manipulate it. There’s no reason to give the <img> tag an id or a class, because we can just say #footer img and since it’s the only image in there, we can call it that way. This keeps our HTML a little simpler.

Step 5

Now the CSS for our code so far:


body {
	margin:0px; padding:0px;
	background-color:#11090a;
	font-family:Arial, Helvetica, sans-serif;
}
#outside_container {
	background:url(images/background_slice.jpg) repeat-x #000000;
}
#container {
	background:url(images/background_main.jpg) no-repeat;
	min-height:800px;
}
#footer {
	border-top:1px solid #3f2324;
	padding:30px 50px 80px 50px;
}

So going through one at a time:

  1. First we are redefining the body tag. This is almost always the first thing I do. We get rid of any default margin and padding, set a background color and a font-family for the page. Notice that the background colour is in fact the footer background colour. As I mentioned previously this is so that if you stretch the browser window vertically you’ll keep seeing footer.
  2. Next we have the outside_container tag. I’ve given it that slice background, it’s going to repeat only along the x axis (i.e. from left to right) and wherever there’s no background image we’ll see straight black (#000000). So basically as the page gets longer the tiles won’t keep going because we said to only repeat left-right, instead we’ll get the black background. This is perfect because our tiling image fades to black!
  3. Next we have the container. Here we have the gigantic background image set to not repeat - so it only appears once. Notice we didn’t specify a background colour, if we had it would have covered our outside_container over. That’s because this <div> tag is inside the previous one, and will automatically be stretching out to fill it up completely. So our background image appears on top and then outside that area you can see the outside_container background showing through.
  4. I’ve also given the container a minimum height, this is just so that when we look at the HTML page at this point you can see roughly how it’s going to look when there is content. Later on our content will produce the minimum height anyway.
  5. The footer is basically just a single line border and some padding. There’s no need to give it a background colour, because we set that in the <body> earlier. Remember with the padding definitions it goes like this: padding: top right bottom left (clockwise!)

Here’s where we are up to now…

View The Site So Far

Step 6

Next we’ll finish off that footer by adding a few extra styles like this:


/*
	Footer
*/
#footer {
	border-top:1px solid #3f2324;
	padding:30px 50px 80px 50px;
	color:#674f5d;
	font-size:9px;
	line-height:14px;
}
#footer img {
	float:left;
	margin-right:10px;
}
#footer span {
	display:block;
	float:left;
	width:250px;
}
#footer a {
	color:#9e8292;
	text-decoration:none;
}
#footer a:hover { color:#ffffff; }

So here I’ve added a few bits to our #footer class and created a few more classes. Let’s go through it one piece at a time:

  1. First of all the bits between /* and */ are CSS comments. It’s nice to have comments in your CSS file as it really breaks it up and helps keep things intelligible. Actually on larger projects I find CSS files can get pretty out of control if you’re not careful. So it’s really good to try to get into good habits early: name your selectors well, add comments, keep like things together, break into multiple CSS files for larger projects and so on.
  2. In #footer I’ve added a font color, font size and line-height to our previous definition. Line-height is a really useful text attribute as it helps you space out your text. Without good line-height text can look bunched up and harder to read. Too much line-height and the text will be so spaced out it looks weird. So you might want to experiment to find the right heights for different fonts and sizes. Here 14px seemed like a good fit.
  3. Next I’ve set the #footer img and #footer span to both float:left. Because they are both set to float left, they end up in columns next to each other. I’ll talk more about floating and columns later in this tutorial.
  4. Finally we tell the browser what to do with <a> tags (i.e. links) that appear in the footer. Namely that they shouldn’t be underlined, and should change color when you hover over with a mouse.

So with the addition of the footer here’s where up to:

View The Site So Far

Step 7

Now with the footer out of the way, let’s add some more content to the page inside the main container areas. First we need two new images that we make out of our PSD file:


Notice that I’ve used an image for the big text block. In general it’s best to use text for these things as it makes the page much more searchable and is good practice. But it would have been much harder to do as we’d need to use a bit of Flash and SIFr to achieve that effect. So since this is a fairly straightforward tutorial I’ve opted to just use a big image :-)

Here’s a snippet of our HTML code - just the containers bit:


<div id="outside_container">
	<div id="container">

		<a href="#"><img src="images/logo.jpg" id="logo" /></a>

        <ul id="menu">
        	<li><a href="#">Retouching</a></li>
        	<li><a href="#">Digital Effects</a></li>
        	<li><a href="#">Web Work</a></li>
		</ul>

        <ul id="right_menu">
        	<li><a href="#">About</a></li>
        	<li><a href="#">Contact</a></li>
        </ul>

        <img src="images/panel_home.jpg" id="panel" />

		<div id="content">

        	<!-- THE CONTENT GOES IN HERE -->

        </div>

	</div>
</div>

So inside the container area we’ve added five things:

  1. Our logo: It’s linked, so clicking it should take you to the homepage, and has id="logo"
  2. Main menu: This is simply an unordered list with id="menu"
  3. The right hand side menu: This is the same as the other menu, just different id="right_menu"
  4. Big text panel image: This is our main heading text saved as an image, id="panel"
  5. Content Div: And this is where we are going to place all our page content later on. I’ve left it empty right now except for an HTML comment.

So before we start styling it up, it’s worth having a look to see how the page looks with just everything dumped on like this:

As you can see we’re going to have to do some serious shifting around to get everything into place. As you’ll recall we’re going to use Absolute Positioning to do this quickly and easily.

Step 8

Here’s the CSS we add to make our elements start to fit into place:


#container {
	background:url(images/background_main.jpg) no-repeat;
	min-height:800px;
	width:1000px;
	position:relative;
}

/*
	Logo / Menu / Panel Positioning
*/

#logo { position:absolute; top:58px; left:51px; }

#panel { position:absolute; top:165px; left:51px; }

ul#menu {
	margin:0px;	padding:0px;
	position:absolute; top:145px; left:75px;
}
ul#right_menu {
	margin:0px;	padding:0px;
	position:absolute; top:145px; right:75px;
}

So again let’s go through each bit piece by piece:

  1. First of all, you’ll see an old bit of our code - the container. I’ve shown this as I’ve added two more lines to it now. It now has a width:1000px and position:relative. This is important because when you set position to be relative, anything absolutely positioned inside, is done so relative to that container tag. So this means I can position things inside this box, using the fact that I know it’s 1000px wide. Namely I’ll be using that for the right_menu.
  2. Next because this is a new set of CSS, I’ve sectioned it off with a comment
  3. With the logo and panel I’ve given both an absolute position on the page. How do I know what numbers to use? Simple go back to the original Photoshop document and measure out where they are meant to be! You can see it’s a really simple class definition, which is why absolute positioning is so easy.
  4. Next with the two menus, these are also absolutely positioned, but here I’ve also given them margin:0px; padding:0px; definitions to make sure we clear away any default margins and padding which unordered lists have.
  5. Next notice that on the right_menu when I have specified the absolute position to be right:75px. This means that it will appear 75px away from the right hand side of its container. Ordinarily that would be the browser window, but because remember earlier I set the container to have position:relative that means it will be 75px away form the right hand side of <div id="container"></div>.

    Now you might be thinking, well what’s the point, can’t I just position things using left only? Well you can, but with our menu, if you were to add extra menu items you would need to reposition it again and again so that it was still 75px away from the right hand side. Whereas by using right the extra menu items flow left when you add them. Try it and see!

So here’s where we are at:

Step 9

As you can see in the previous image, the logo and heading element are now looking like they are in the right position. But the menus are looking kinda weird. Before we style those, a quick word on the logo / image panel. You might be wondering, if they are both images, why not make them part of the background image?

The answer is that the logo we want to make linkable, so that clicking it will take you back to the homepage (makes the site more usable), and the main text panel, well that would probably change from page to page. So by having it a single image, we can have lots of HTML pages using the same CSS stylesheet but simply positioning a different image there with different text.

Now let’s style the two menus and make our page really start to take shape. To do that we need the following CSS:


ul#menu {
	margin:0px;	padding:0px;
	position:absolute; top:138px; left:75px;
}
ul#right_menu {
	margin:0px;	padding:0px;
	position:absolute; top:138px; right:110px;
}
ul#menu li, ul#right_menu li {
	margin:0px;	padding:0px;
	list-style:none;
	margin-right:10px;
	font-size:9px;
	text-transform:uppercase;
	display:inline;
}
ul#menu li a, ul#right_menu li a {
	text-decoration:none;
	color:#bd92b2;
}
ul#menu li a:hover, ul#right_menu li a:hover {
	text-decoration:none;
	color:#ffffff;
}

The first two bits of this code are the same as before (although I adjusted the positions a little to make them look right after styling). Notice that these two definitions are separate as they have different positions, but after that we’ve combined the two into the same class definitions as the menu items themselves should look the same. The format for defining two classes together is:

.myClass, .myClass2 { … }

This is very different from this definition:

.myClass .myClass2 { … }

Because the second definition says, all elements with class="myClass2" inside an element with class="myClass".

Anyhow so back to our styles, let’s go through some important points:

  1. We’ve set the <ul> elements themselves to 0 margin and padding, and absolute positioning, as we discussed previously
  2. Then we’ve said for all <li> elements inside those <ul>’s we want them to have no list-style (i.e. no bullet points), we want them to 9px, all upper case, and importantly they should display:inline. Inline display means instead of being blocks that appear one below the next, these will appear next to each other!
  3. The next definition says that for <a> link tags that appear inside an <li> tag that are inside <ul id="menu"> or <ul id="right_menu">, they should be a certain colour and have no underline.

And with that, our page is now looking pretty good!

View The Site So Far

Step 10

Next it’s time to add some content! First let’s add some dummy text, set up so that we can make columns. Here’s the HTML:


<div id="outside_container">
	<div id="container">

		<a href="#"><img src="images/logo.jpg" id="logo" /></a>

        <ul id="menu">
        	<li><a href="#">Retouching</a></li>
        	<li><a href="#">Digital Effects</a></li>
        	<li><a href="#">Web Work</a></li>
		</ul>

        <ul id="right_menu">
        	<li><a href="#">About</a></li>
        	<li><a href="#">Contact</a></li>
        </ul>

        <img src="images/panel_home.jpg" id="panel" />

		<div id="content">

        	<div class="column1">

            	<h2>a sleek design</h2>

                <p>Dummy Text: This design was produced for a photoshop and web development tutorial.  You can see the first part up at PSDTUTS.com where you learn how to create a beautiful, but simple design using an abstract background and type.</p>
				<p>The second part of the tutorial is available via NETTUTS.com where we do a quick build of the PSD into a viable, working HTML/CSS site.</p>
                <p>This design was produced for a photoshop and web development tutorial.  You can see the first part up at PSDTUTS.com where you learn how to create a beautiful, but simple design using an abstract background and type.</p>
				<p>The second part of the tutorial is available via NETTUTS.com where we do a quick build of the PSD into a viable, working HTML/CSS site.</p>

            </div>
            <div class="column2">

                <h2>tutorials</h2>

                <p>Dummy Text: This design was produced for a photoshop and web development tutorial.  You can see the first part up at PSDTUTS.com where you learn how to create a beautiful, but simple design using an abstract background and type.</p>
				<p>The second part of the tutorial is available via NETTUTS.com where we do a quick build of the PSD into a viable, working HTML/CSS site.</p>
				<p>This design was produced for a photoshop and web development tutorial.  You can see the first part up at PSDTUTS.com where you learn how to create a beautiful, but simple design using an abstract background and type.</p>
				<p>The second part of the tutorial is available via NETTUTS.com where we do a quick build of the PSD into a viable, working HTML/CSS site.</p>

            </div>
            <div class="column3">

            	<h2>recent work</h2>

                <p>Dummy Text: This design was produced for a photoshop and web development tutorial.  You can see the first part up at PSDTUTS.com where you learn how to create a beautiful, but simple design using an abstract background and type.</p>
				<p>The second part of the tutorial is available via NETTUTS.com where we do a quick build of the PSD into a viable, working HTML/CSS site.</p>
				<p>This design was produced for a photoshop and web development tutorial.  You can see the first part up at PSDTUTS.com where you learn how to create a beautiful, but simple design using an abstract background and type.</p>
				<p>The second part of the tutorial is available via NETTUTS.com where we do a quick build of the PSD into a viable, working HTML/CSS site.</p>

            </div>

        </div>

	</div>
</div>

OK so in this snippet, you can see I’ve added 3 new <div>’s inside the content area. Each one has a <h2> title element and them some text. They have class names column1, column2 and column3. The reason I’ve added all the extra text is to show you something about making columns.

First let’s add some CSS to make them appear like columns:


/*
	Content
*/

#content {
	padding-top:435px;
	padding-left:85px;
	width:815px;
	color:#674f5d;
	font-size:13px;
	line-height:20px;
}
.column1 { float:left; width:230px; margin-right:30px; }
.column2 { float:left; width:230px; margin-right:30px; }
.column3 { float:left; width:270px; }

As usual I’ve sectioned off our new bit of CSS with a comment. Then I’ve set some styles for #content. Notice how much padding-top there is … 435px! This is to make space for all those absolutely positioned elements earlier. Unlike those elements this content area is in the normal flow of the page.

It needs to be in the regular flow because as you add more content to it, it should push the footer down. If this was absolutely positioned it would just go over the top of the footer.

Now the three column classes, notice they are each set with a width and with float:left. This tells them that they should drift to the left of the page aligned next to any other left floating elements. I’ve given the first two a right margin so they aren’t stuck to each other.

Floating an element makes it drift to the left or right, and tells everything else to wrap around it. When the other elements are also floated, they form into columns. Generally any time you see a column layout, it’s using floats.

Unfortunately there is one weird problem with floats. Namely that they have a problem with their containers. Instead of pushing the next elements down, they just drift over the top. The way to solve this problem is to have an element that comes after them which has the property clear:both.

The Clear property says to stop wrapping stuff around the floating <div>’s. It’s a bit hard to explain, so let’s look at what happens with and without the clearing.

Without Clearing
Here is how the layout looks as is:

See how the columns have drifted over the top of the footer, and the footer itself has started wrapping around them. That’s not right!!

With Clearing
The solution is reasonably simple, we need to add a <div> after the three columns like this:


<div id="content">

    <div class="column1">

        <h2>a sleek design</h2>

        <p>This design was produced for a photoshop and web development tutorial.  You can see the first part up at PSDTUTS.com where you learn how to create a beautiful, but simple design using an abstract background and type.</p>
        <p>The second part of the tutorial is available via NETTUTS.com where we do a quick build of the PSD into a viable, working HTML/CSS site.</p>
        <p>This design was produced for a photoshop and web development tutorial.  You can see the first part up at PSDTUTS.com where you learn how to create a beautiful, but simple design using an abstract background and type.</p>
        <p>The second part of the tutorial is available via NETTUTS.com where we do a quick build of the PSD into a viable, working HTML/CSS site.</p>

    </div>
    <div class="column2">

        <h2>tutorials</h2>

        <p>This design was produced for a photoshop and web development tutorial.  You can see the first part up at PSDTUTS.com where you learn how to create a beautiful, but simple design using an abstract background and type.</p>
        <p>The second part of the tutorial is available via NETTUTS.com where we do a quick build of the PSD into a viable, working HTML/CSS site.</p>
        <p>This design was produced for a photoshop and web development tutorial.  You can see the first part up at PSDTUTS.com where you learn how to create a beautiful, but simple design using an abstract background and type.</p>
        <p>The second part of the tutorial is available via NETTUTS.com where we do a quick build of the PSD into a viable, working HTML/CSS site.</p>

    </div>
    <div class="column3">

        <h2>recent work</h2>

        <p>This design was produced for a photoshop and web development tutorial.  You can see the first part up at PSDTUTS.com where you learn how to create a beautiful, but simple design using an abstract background and type.</p>
        <p>The second part of the tutorial is available via NETTUTS.com where we do a quick build of the PSD into a viable, working HTML/CSS site.</p>
        <p>This design was produced for a photoshop and web development tutorial.  You can see the first part up at PSDTUTS.com where you learn how to create a beautiful, but simple design using an abstract background and type.</p>
        <p>The second part of the tutorial is available via NETTUTS.com where we do a quick build of the PSD into a viable, working HTML/CSS site.</p>

    </div>

    <div style="clear:both"></div>

</div>

See the <div style="clear:both"></div> down the bottom? It’s just an empty <div> that says to clear out the three columns. And it fixes our problem,

View the Site Here.

A Few Last Words on Floats & Clearing Them
You might be wondering why I didn’t place the "clear:both" into the <div id="footer"> definition, but unfortunately that doesn’t work out because of the background we’re using … here’s a screenshot:

Apparently there is a solution that doesn’t involve inserting a useless <div> tag, and you can read about it at QuirksMode. Personally I’ve been using this method for a while, and it works well and consistently so I keep doing it.

Step 11

OK, almost there now!! The main layout is all sorted, all we have to do is add and style our content. Here’s the HTML for it: