There are two really fantastic and, more importantly, free solutions for custom blog creation: Joomla and Wordpress.
Being open-sourced, Cascading Style Sheet (CSS) based systems, there's a huge community of designers and programmers providing free layout templates for both options. However, templates can't work for every website, and what if you don't want a design that anybody else can have?
Luckily, the process for building a customized template for either Content Management System (CMS) begins the same way: building your design as simple HTML and CSS.
This tutorial is NOT for learning:
How to install these CMSes on a variety of server types.
How to design a good looking site.
How to create PHP from scratch.
How to optimize a site for search engines.
All this tutorial is meant to do is take your design from Photoshop to either Joomla or Wordpress, using CSS and customized PHP.
Programs I'll be using:
- Adobe Photoshop
- TextEdit
- Firefox
Getting Started
Like I previously mentioned, this tutorial isn't about what looks good. I assume that you've got your "dream" layout made in Photoshop, but you don't know how to make your actual website look like it.
The example we're going to use is the redesign of Out To Lunch Productions' website. We love those guys (that guy, really. It's just one dude.)
Identify what's what
You'll need to do a fair amount of planning to get your CSS code right. Take your design and identify which elements will need their own DIV CLASS and which ones will need their own DIV ID.
Class vs. ID
For multiple elements that will use the same div attributes, you need to use div class instead of div id. You shouldn't have more than 1 of each div id. IDs use a preceding "#" and classes use a "."
HTML
<div id="header">Element used once</div>
CSS
#header {}
HTML
<div class="sidebox">Element used more than once</div>
CSS
.sidebox {}
Universal elements, like body, h1, h2, etc., do not require a preceding . or #.
Creating a DIV plan
Here's what the page will look like:

Target layout - no DIVs.
And here's what the DIVs will be:

Target layout - DIV-ided
You can't create a good design without a good plan. You should know, before you even open Photoshop, the answers to these questions:
- How many columns will it have?
- How many navigation menus will it use?
- Will the menus be horizontal or vertical?
- Does it have a footer?
Necessary Graphics vs. Solid Colors
Your design elements (that aren't type) should fall into two categories; graphics vs. solid colors. This is pretty intuitive. If it's a logo or a picture or anything that is not a solid color, then it's a necessary graphic. If it's a rectangular block of color, then it's a solid color.
Using the slice tool, cordon off your necessary graphics and your solid colors.

Click to enlarge
Building the HTML
You're not going to spend too much time here. Most of the HTML that you're going to be formatting will be generated by whichever CMS you choose, so don't worry too much about setting anything other than the general layout at this point. Also, I'm going to stick to the example design pretty closely. Since you're not building the exact same site, you'll need to adjust your work accordingly.
Use a text editor that has your HTML and CSS files open at the same time, while your favorite web-browser (Firefox) has your HTML page loaded in it. Every time you make/save a change on both documents, hit reload in Firefox.
Create two blank documents in a basic text editor. Make sure that they're both plain text. Save them in a new folder as index.html and style.css.
If you're having a problem formatting a particular DIV, you can get its properties by using a plugin like Web Developer (https://addons.mozilla.org/en-US/firefox/addon/60).
Copy and paste the following code into your HTML document:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /
<title>YOUR PAGE TITLE GOES HERE</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
</body>
</html>
This code lets the browser know what kind of page it's dealing with, which helps your design look correct in more browsers. Also, the <link> tag attaches the stylesheet that you'll be working on to your HTML document.
Next, add the wrapper, header, menu, quote button, joke, main content, sidebar and footer divs. Now your code should look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /
<title>YOUR PAGE TITLE GOES HERE</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="wrapper">
<div id="header">
</div>
<div id="menu">
</div>
<div id="quoteButton">
</div>
<div id="joke">
</div>
<div id="mainContent">
</div>
<div id="sidebar">
</div>
</div>
<div id="footer">
</div>
</body>
</html>
Notice how the header, menu, quoteButton, joke, mainContent and sidebar divs are nested within the wrapper div. This setup will "wrap" your main divs together so that they can be treated as a singular unit on the page.
Building the CSS
Now, switch over to your stylesheet. Start with this:
* {
margin: 0;
padding: 0;
}
This code will make sure that all of your divs start with a margin and padding of 0. It reduces reduntant code and makes for easier design. Now, add in the code for your other divs.
body {
}
#wrapper {
}
#header {
}
#menu {
}
#quoteButton {
}
#joke {
}
#mainContent {
}
#sidebar {
}
#footer {
}
Alright! We've got our basic site structure in place, and it's time to start editing! Here are some very helpful CSS attributes:
- background - Sets the background image, image placement/repetitions, and color of the element.
- margin - Sets the spacing outside of the element.
- padding - Sets the spacing inside of the element.
- width - Sets the width, in px, of the element.
- float - Very important. Allows for divs to sit next to each other horizontally.
- clear - Forces the element to sit below any elements floated the left, right, or both.
Type Setting
One of the most crucial elements of web site design is how your type is going to look. What font face do you use? What color? What size? What margins and padding do I need?
Typography CSS attributes:
font - Chooses the font family. List of web-safe fonts.
font-weight - Normal or bold your element's words.
font-size - Sets the size of your type.
line-height - The space between your lines.
color - The color of your element's words.
Using images in your CSS
To get the background to look like it does in the original design, we're going to use the background CSS attribute with an image slice and a solid color.
Here is the background image:
And here is the code:
body {
background: url(../images/Background.png) top repeat-x #FAF8EB;
}
By specifying the vertical positioning (top) and which direction the image should repeat (repeat-x) I was able to restrict the image to repeating across the top of the page, and by using a solid color that matches the bottom of the image, I was able to extend the background all the way to the bottom of the page.
The Next Step
Now comes the tricky part: Creating the template for the appropriate CMS. Since the paths diverge here, you'll need to click on the appropriate link for the tutorial.
Joomla!
Wordpress COMING SOON
Thanks for reading my tutorial, and please don't forget to read our comic. It constitutes a full day's worth of awesome.
Also, people who want to know how to make a graphic appear to be overlapping another one without using transparencies, read the tutorial on Image Overlapping with CSS.