Call Us : 0845 519 0437

Email Us


18
Sep

CSS: The Missing Manual
Overall Rating:
 
Retail Price: £26.99
Amazon Price: £14.11
I have noticed that a lot of visitors are coming here from Google after searching for this tutorial, so, here you go.

1. Open Photoshop and a blank transparent canvas of say 20×20 pixels. Now, zoom right in to about 1200% and select black on your palette and the pencil size 1. Draw a diagonal line from corner to corner (tip : click the first corner, let go and place your pointer on the other corner. Hold “shift” and click again. A straight diagonal line will appear)

Now do the same one pixel either side of the line you have just drawn, so you have a thicker diagonal line.

Do the same again, and then again until you end up with this:

diagonal-1.gif

Now we have to add two little bits in the other corners like the image below.

diagonal-2.gif

Hold “Ctrl” and press “A” to select the whole canvas. Now click “Edit” – “Define Pattern” and call it whatever you like. You can now close that canvas, we have finished with it.

Now, here’s what I do. Open a new canvas say 500×500 with a background colour of whatever you want the background colour of your page to be. I chose blue (#2E3192).

Now add a new layer and select the Paint Bucket tool, select the “Fill” option to “Pattern” and click the little drop down arrow next to it and find your newly added pattern and click on it. Now place the paintbucket inside your canvas and click.

You’ll probably think the lines are too dark, but simply changing the opacity of that layer to something like 20% or 30% will do the trick.

Now, merge your visible layers (click the arrow in the top right of the laters bit and choose “Merge Visible”).

Now drag a guide 20px from the top of the canvas, and another 20px from the left edge and using the rectangle marquee select the top left corner using the guides. Click “Ctrl” and “C” to copy, then “Ctrl” and “N” for a new layer. Click “ok” then “Ctrl” and “V” to paste onto the new layer. You should now have the same as the image below:

diagonal-3.gif

Save this as a .gif and call it something like body-bg.gif so you know what it is.

All you need to do now, is in your CSS file for your website, add the following:

body {
background-image: url(“images/body-bg.gif”);
}

This will now tile your little 20×20 gif all over the page giving the diagonal stripes!!

You can experiment and change the canvas size and draw thicker or thinner lines to achieve different sized lines.

Have a go!

Related posts:

  1. Create a simple web page with CSS and a background image
  2. Make a simple diagonal page background – version 2
  3. How to create a tiled background for your web page
  4. Creating depth with your image compositions in Photoshop
  5. Is the diagonal line background style old hat now?

Category : Blog / Tutorials

25 Responses to “Make a simple diagonal page background using photoshop and css”


Maris September 19, 2006

Nice tutorial, I think it is very helpful for many web designers who start to learn things how to do this and that.
Thanks!

Ben September 19, 2006

Thanks Maris, it’s surprisingly hard to put into instructions what us web designers take for granted and do every day!

Mama Duck September 19, 2006

Great tutorial & way to interest those visitors! Our list is up as well if you’d like to check it out!!

Matt September 19, 2006

Nice tutorial! I have wanted to do that with a few websites. I kind got the jist of the CSS by looking at some examples of other sites. I like how you show the steps to put the graphic together. My How To is up if you want to check it out.

Ben September 19, 2006

Thanks Matt, my aim is to post more tutorials like this for beginner web designers over the coming weeks / months etc.

Northern Girl September 19, 2006

Hey – thanks for the ‘how to.’ I’ll have to try it, now.

(Found your post through ProBlogger)

Ben September 19, 2006

Thanks, glad you found it useful

Jersey Girl September 19, 2006

simple and to the point…like that!

Ben September 19, 2006

It’s the only way really :)

Mark September 25, 2006

Hi Ben,

Nice little trick :)

Fabio Fidanza March 26, 2007

Take a look at http://www.stripegenerator.com
You can create stripes background in a snap!

Ian August 1, 2009

Hi,

thanks for this tutoria, and sorry but I could not follow the last bit at all. I got around this by simply creating the image, mine ended up being 7×7 pixels for the effect I wanted, checking it tiled correctly by making it a pattern, and using the following css,

.div
{background-image: url(diagonal.gif); background-repeat: repeat;}

cheers mate,
Ian

Ben August 8, 2009

Hi Ian, can you show me what you have for your HTML please?

sarah le February 26, 2010

I’ve read a few tutorials on this same subject, but yours is the best! It worked for me on the first try. Thanks!