Photoshop To Mock A Web Design… then code it!



Using Photoshop To Mock A Web Design… then code it!

The .PSD file is the greatest tool and resource to any web designer. Sure, you could create a design from scratch, coding by hand with no help from The trusted and handy photoshop… and that’s even how I started… but I bet once you get the chance to learn the tips and tricks that I will point out

In this article, you will wonder how NOT using .PSD’s for your design is even possible.


Here is the sample design we are going to make:

You can download the Website Layout psd: Download psd Weblayout

First things first. Open your version of photoshop (I’m using CS3 here but CS2 is perfectly fine). Now to begin, lets first do something of personal Preference. This isn’t necessary but it may help you with the layout and arrangement of photoshops tools and menus… by changing your “Workspace.”

Photoshop  to mock a website

Photoshop to mock a website


You can download the Website Layout psd: Download psd Weblayout

To do this, go to : Window -> Workspace and select “Web Design.” Now you see the Adobe Teams idea of a Photoshop workspace for Web Designers. It highlights Important menu items and arranges the tools that most web designers will use.

Now lets begin to create a layout, in which later you will code into CSS and XHTML.

In CS3 (and CS2 I believe) you can select resolution presets for the web. So hit CTRL + N to open a new document. Under “preset” select “Web.”

Now select “1024 x 768.” I choose that over 800 x 600 because the majority of visitors will be seeing your webpage in that resolution- you can

Code it to shrink to an 800 width later on.

Now with your document open in 1024 x 768, we are going to begin the creative process. We will start from the top down. So begin with the header.

Start a new layer (ctrl + shift + N). Select your marquee tool (M) and draw a region from the top left to the top right with the height of about 85px… or whatever You think looks nice.

Now fill in that layer with any color you prefer. To make this look more modern and trendy you can fill it in with a gradient. Try one of the “Web 2.0 Gradients”

On this website. To do this, right clik the layer and select ‘Blending Options’ then on the left side menu select ‘Gradient.’ You can choose which gradient You feel works for a header. Sample them all.

Once the header block is complete, create a new layer again (ctrl + shift + N) and, just under the header block, use your marquee tool (M) to create a new block For your navigation. Try a height around 30 – 35px. Then, repeat the steps above- filling in the color and selecting a gradient.

Now this is a good time to mention organization of .PSD files. In photoshop you have the option of creating folders for sets of layers or elements. To do this, find the small folder icon under the layers palette at the bottom right of of the photoshop window. Name these folders (and color code them if desired) with

a description of the type of elements they will contain, such as “header” or “navigation.” Then drag those layers into the corresponding folders.

This will keep you from having to scroll through the entire layer pallete to find that one layer that needs adjustments. It is also good for moving entire blocks Of layers and for hiding them temporarily.

Moving on with the design we are now going to draw a simple css box with an image. In the .PSD or screenshot above you will see this used as an “intro box.” Most websites or blogs use these to introduce the readers to their website or to update readers with important news and info.

So create a new layer (and folder if you are an organization freak like I am) and draw using your marquee tool the selected width/height and position Of the intro box. Now fill it in with your desired color. Once complete, right click the layer and go to ‘Blending Options.’ Find and click the ‘Stroke’ Option. Turn down the size of the stroke to 1px and change the color to something in the same color range as the background of this box- darker works Better.

For the image its just a matter of copy + paste into the right position.

Do the same for the sidebar. This is called “blocking out a design.” This will help you when coding the design. Also fill in a headline and mock up post under that.

This is just a sample and of course you can adjust and optimize this more and more… the real reason for this article is to go over those basics above and more importantly, Show you how to take a design and turn it into a working webpage with CSS and XHTML… WITHOUT “slicing.” I’m not a fan of slicing- and it’s pretty obvious why… simply Using your marquee tool with the layers makes much more sense.

Now go onto your webserver and set up a directory to test this out. I use the backend of wordpress to code almost everything since it is so versatile but You can use notepad/textpad or any text editor you feel comfortable with (if you’re really hardcore use ‘vi’).

Now how do we code this? Simple really. Like I said, all you need is your marquee tool and every element in its own layer in photoshop. So now with your

Text editor open lets make the header you mocked up above.

Select the height of your header to the exact pixel with your marquee tool. Select edit and “Copy Merged.” Now hit ctrl + n for a new image. Paste the background

Of the header that should be in your clipboard right now. Most likely your pasted image is a bit too wide. Lets select the entire image (ctrl + click the layer) and zoom In a couple times. Now using your arrow keys, hit left as many times until you cant see the blinking outline of the marquee tool- then hit your right arrow once.

Now you should just barely see it. Crop it. What you just did is select only 1px width of the hearder background image. You wont need any more then this- css Will do the rest.

Now save and/or upload this image to your webserver (you can do this locally first). Go back to your text editor.

The blank text document in your editor will be the .css sheet so lets save it as “style.css”. Open it back up and lets start the coding. Oh and by the way- keep That header background image open in photoshop.

Now first your going to want to do the basics of your css file like body { background:#FFF; } or anything else you may want to do- for this example it’s not necessary So lets skip it.

Create a css element called “#header” like so:

#header {


Now maximize photoshop again, and with that head background image open, select “Image” and then “Image Size” – take note of the height.

Use that height in the #header css element like so:

#header {

Width:100%; height:115px;


Also set the width to 100%. Now lets put in that background image and repeat it across the width of the page:

#header {

Width:100%; height:115px;

Background:url(img/header_bg.gif) repeat-x;


Save that and open another text document for our .html page. Save it as index.html when you are finished. In the index.html file set up your basic html tags:


<head><title>My Design</title></head>


Now add this division tag under that:

<div id=”header”>


Save and open index.html in your web browser to view the changes.

Notice you have the header…. Why that was easy wasn’t it?

Do the same for the nav… put the division (i.e.: <div id=”nav”></div>) right under the header nav. Repeat these steps until each box is on your webpage… And really you could close this article right now as you’ve learned how simple it is to make a web page using photoshop and css xhtml by just repeating these steps.

Next you’re going to want to learn about margins and padding, positions, floats and so on. Don’t worry- its not at all difficult. Practice this for awhile.

Try to create the .PSD you downloaded into a whole web-page… can you do it? Show us! Post it in the comments if you think you have the right skills… If not, don’t worry- repeat these steps with each element and you’ll get it sooner or later.

Next time we will go even further…

Leave a Reply