Wednesday, July 23, 2008

Web Developer Tip #1 - Working from mockup-image website templates

Often, in every Web Developer job, there will be a time when you have to work from a mockup website design template in the form of an image, usually a PhotoShop file or maybe a flat jpeg file. I know toggling between PhotoShop and the web browser, playing "web developer, spot the difference" can be frustrating - at times the website just doesn't look right but you can't find even the most clearly obvious things.

If you use Dreamweaver there is an option to setup a tracing image to put under the design view's rendering of the webpage ("Modify > Page Properties... > Tracing Images"). This method is really rather limited though: -
  • it relies on Dreamweaver's own built in webpage render
  • the tracing image is not rendered in a browsers and so can not aid cross-browser checking
  • the tracing image is below the webpage and so it becomes obscured as the page content is built over the top of it
And so, now we come to my method of template image copying:-

I have just completed the Metafocus Global Internet Marketing website and I must say, I am rather pleased with the results. Significant reasons for my pleased-ness are the excellent designs provided to me by Andy, our designer, and the templating system that I am now going to describe.

It is a really a simple method: -
  1. save the template image as a jpeg if it isn't already
  2. use css styles to set the image as the <html> tag's background-image
  3. change the <body> tag's opacity on the fly, using css styles

Example CSS

html
{
background-image: url(images/template.jpg);
background-repeat: no-repeat;
}

body
{
background-color: #FFF;
opacity: .7;
filter: alpha(opacity=30);
}
The opacity attribute (0 to 1) is used to change the opacity value in all standards compatible browsers and the filter attribute (0 to 100%) is used to change the opacity in IE.


...and as an added bonus you can set the body opacity to none and watch as your friends, family and workmates scratch their heads trying to figure out why the links aren't working :p

No comments: