Post
So, you’ve designed your next site but you’re having a little trouble turning your lovely PSD into a coded layout. This tutorial should help you learn how to analyze either a new template, or even your current layout to find the best way to code it.

(_Click image for a larger version_)
Here is a basic design composition. The problem now becomes turning it into code while maintaining the style and structure that was decided upon as well as making sure that the site is accessible across browsers/platforms and is as light and elegant as possible.

(_Click image for a larger version_)
The first thing I do once I receive a finalized composition is attack it with a pencil. Analyze every detail of the layout and write down what you think will work. Begin by marking up the widths and basic structure of the site and then move to the details such as the typeface and font-size.
The full PNG of the layout above as well as the font used can be downloaded here
(_Note: You can remove the red markings by making the “Code Overlay” layer invisible._)
Now that we have a good idea of where we’re going, let’s get started.

The first task is to set up your files; luckily, Dreamweaver takes care of that part for me. I usually keep my CSS right in the header when I’m getting started so that I can set up the markup and styles side by side.
I’ve decided how I will be applying the drop shadow – a background on the body will be the easiest and won’t require any extra markup.

By applying the CSS for the background image as well as the “page” div, we now have the basic structure we’re looking for.
body {
margin: 30px 0 0 0; padding: 0;
font-family: Arial, Helvetica, sans-serif;
font-size: 0.9em;
background: url(images/body_bg.png) center top no-repeat;
}
#page {
width: 619px;
margin: 0 auto;
padding: 30px 40px;
border: 1px solid #eee;
}
*Take a look at Step 1*
It is best to complete the structure of the layout before moving on to details such as the logo. Setting up the sidebar and main column before moving on makes it easier to locate and fix any problems.
With a few more CSS rules defining the sidebar, main column and footer, the layout is complete. The only step now is to fill in the details.
#sidebar {
width: 180px;
padding: 0 20px 0 0;
float: left;
}
#main_column {
width: 390px;
padding: 0 0 0 20px;
float: left;
}
#footer {
clear: left;
}
*Take a look at Step 2*
After adding the logo using the negative text-indent method (as well as an overflow: hidden to cut the Firefox dotted border short) and floating an unordered list to create the navigation, the coding is almost complete. Once the CSS has gotten to a point where it is no longer efficient to keep in the markup, move it to a separate stylesheet.
*Take a look at Step 3*
With a little more basic tweaking of colors and headline styles, the design is complete. It may seem like I skipped a great deal between steps 3 and 4, but all of the changes were simply modifying the default styles to match our design.
*Take a look at Step 4*
The most important thing to remember when coding a template is to follow the logical path of coding and testing the basic structure first and then moving to the details later.
The template, images and code are all free for your use and can be downloaded here. Good luck with your own work.
Archive
-
260.
The Phenomen- ology of Freedom
Are we truly free? Are the paths of our lives charted beforehand, or is every moment an opportunity to break new ground? The answer isn’t easily found, the determinate physical world seems to hit a...
-
260.
An Open Letter to God.
So here’s the deal, we’ve been here a while doing great things and…eh things, but there’s always been that trickling or gushing concern about why. We’re amazing, when you stop to think...
-
260.
Nietzsche: The Fast Track
The darkly dressed student made yet another existentially pessimistic remark and the professor unleashed one of the harsher insults I’ve heard: “Every student goes: Nietzsche, Schopenhauer,...
-
260.
Computers and God
I came across an interesting presentation on digg (and surprisingly, it wasn’t a kitten with horrifying spelling/grammar) recently that compared – albeit often fallaciously – our...
-
260.
Surviving Life
The questions we ask are not ones we can ponder in our free time and easily set aside when there’s life to do. What am I? Am I free? What is the purpose of my existence? Why should I strive to...
-
260.
The New Erratic Wisdom
Another semester, another redesign (give it a solid refresh to clear your cache). This one’s been brewing for quite some time now, with the notched grid motif coming around a few months ago,...
-
260.
Imperfect Art
Plato’s metaphysics and his Doctrine of Forms describes a general division of our universe into forms and particulars. Forms are instantiated by contingent particulars. That is, particulars are...
-
260.
Identity and Time
A classic example in the metaphysics of identity is the “Ship of Theseus” story which introduces an interesting worry in the way we identify objects over time and change. First, a brief...


















Comments
stdmedia
Jan 29, 08:31 PM #
Nathan Smith
Jan 29, 11:13 PM #
Matt Jones
Jan 29, 11:49 PM #
Bas Wit
Jan 30, 01:28 AM #
Rene
Jan 30, 02:41 AM #
Can you explain the “the negative text-indent method”?
Conny Lo
Jan 30, 04:05 AM #
This means that the text of the headline will be out of the visible area, in this case a width of 241px and a height: 37px.
More information: http://phark.typepad.com/phark/2003/08/accessible_imag.html
Rene
Jan 30, 04:10 AM #
schnuck
Jan 30, 07:28 AM #
And how one goas about masking off area of imagery, or titleing texturesa for boxes of text that slide liquid style :D Now THAT would be a tutorial!
tripdragon
Jan 30, 08:32 AM #
schnuck
Jan 30, 08:38 AM #
I am with Nathan regarding the clear: both; in the footer.
James Mitchell
Jan 30, 08:51 AM #
Conny Lo: Rene answered your question right, but here is a live link to the Mike’s image replacement method.
tripdragon: Maybe I’ll do that next :D
schnuck: You got me, I’ll fix it as soon as I get a chance.
Thame
Jan 30, 09:04 AM #
Neil
Jan 30, 10:54 AM #
I mean, the advice is to name the css classes independently of its style. You shouldn’t use “red_title” even if it’s for your h1 with color:red.
Naming a block “footer” implies that we’re going to show it below everything else, and it’s the same mistake as a “red_title” class, but for layouts.
I think it’s better to describe the block content instead of its position.
Julio Nobrega
Jan 30, 12:01 PM #
Dustin Brown
Jan 30, 12:19 PM #
Carl
Jan 30, 01:56 PM #
div id="footer". Fact of the matter is, you have to name it something, so it might as well be easy to remember.Nathan Smith
Jan 30, 03:04 PM #
Tony
Jan 30, 03:20 PM #
Matthew Price
Jan 30, 04:20 PM #
-Neil, I think the assumption here is that the coder knows semantic markup already.
supa
Jan 30, 07:47 PM #
1. CSS is just as important as HTML if not more so these days, you really shouldn’t have one without the other so learning fundamentals of HTML BEFORE CSS is not a good idea… they should be learnt together.
2. Header, Footer etc are all standard type ids for these sections and even if you remove the CSS they should, ideally, still appear in that order so the naming of these sections as such is not the same as calling a tag red_title.
All in it’s not a bad tut at all. It’s good to see people giving back as this does.
Tyroga
Jan 30, 08:03 PM #
-jRad
Jrad
Jan 30, 09:47 PM #
Conny Lo
Feb 1, 02:00 PM #
But just a correction: after adding full size I don’t have 700px but 690px !!
Maybe I’m wrong.
Thanks!
MsrFR
Feb 2, 04:13 AM #
The CSS is promise is to separate content from layout. The same argument that people do about red_title applies to footer. Don’t tie the CSS class names to the presentation.
You will only “get” this when the menu has to be moved from the top to the right side of the viewport. Or when the company info, currently at the bottom of the page, has to be eliminated completely because your page is going to be displayed on a cellphone.
Also, skinning a web page, with different CSS files depending on user preferences, for example, drive us to the same red_title problem. When your alternative layout involves re-positioning of elements, the “footer” and “header” class names don’t have the same meaning.
It’s not a huge problem, if a problem at all for most people. But I see a double standard here, and a tutorial which tell us about the good things of CSS should also teach that CSS can change layouts easily. And if CSS can decouple content from presentation/position, why make the same color/size mistake?
What others do, even gurus or successfull people, really doesn’t matter. Everyone makes mistakes, and I see this as one. I have my own share of guilty, I’ve used “header” and “footer” too. I just think that it’s better not to use these names, and nowadays I try to avoid them.
It’s just better practice, you know? :)
Julio Nobrega
Feb 2, 07:22 AM #
owerflow works fine.. but dotted border is still there… to fix that you shoul ad => outline: none;
Mihael
Feb 6, 05:34 AM #
Thame
Feb 6, 06:19 AM #
Phyllis
Feb 23, 09:44 PM #
Otherwise, I will be writing a more in-depth article as soon as I have more time.
Thame
Feb 24, 02:30 PM #
Best Ghana Website Designers
Jun 24, 11:17 AM #
bart
Aug 3, 06:08 PM #
Rhys
Sep 3, 02:58 AM #
Can you explain the “the negative text-indent method”?
Andy
Nov 15, 05:36 PM #
Danila
Dec 3, 05:14 PM #
it is simple but some not how can i convert psd file to html
<a href=“http://www.cicekclub.com” title=“çiçek”>çiçek siparişi</a>
cicekclub
Jan 24, 07:17 AM #
Great, great and great, this tutorial have save my life. i just can say “I love u” thanks for this great tutorial, hope u never stop making the kind of great resources
Adnhack
Apr 22, 06:32 PM #
Well first of all thank you for a great tutorial…
Mainly not overwhelming people with details…
That was a big problem with others I’ve looked at.
...It brought some things to light for me.
Actually I’m impressed with the whole thing and not just for the tute… its a box model in its finest… “Indented” execution
You do one thing then move on to the next…
Brilliance is in the simplicity…
Still I strugle with replacing images though. Any wisdom on that, really hate to dirty it all up with that ugly TABLE tag {teeth screeching sound}.
zerofirefox
Sep 7, 02:06 PM #
Add a Comment
Phrase modifiers:
_emphasis_
*strong*
__italic__
**bold**
??citation??
-
deleted text-@code@Block modifiers:
bq. Blockquote
p. Paragraph
Links:
"linktext":http://example.com