Posts Tagged ‘HTML’

From PSD to WP series – Part II

Monday, October 19th, 2009

It’s finally published.

From Photoshop to WordPress – Part II – Coding

I’ve said it before and I’ll say it again… lesson learned. I never thought it would have taken me so long to write it but life comes at you with unexpected road bumps and you just have to deal with it. From now on tho, if I ever do another series, I’ll make sure all the parts are written before publishing the first one.

I’m just so happy that it’s out there and I hope it will help some of you learn how to slice a Photoshop mockup.

Like anything else in Web Design, understand that this is merely one way of doing it. It’s how I’ve done it for the past 10 years and it’s worked great for me.

As for Part III, I’m starting it this week and I hope to publish it in the coming weeks.

Thank you for you patience!

Some Tips & Tricks

Thursday, December 4th, 2008

Just wrote a few Tips and Tricks over at The Web Squeeze. ID’s and Classes in CSS was posted last week and today, Extending the background around two floating div’s just went live. Obviously, these are intended for newcomers to the CSS game. Hopefully these 2 will help some of you out there.

7 Easy Tips To Make Your HTML Efficient

Wednesday, April 2nd, 2008

Now let’s see what you can do to make your HTML better.

Use a DOCTYPE

Probably the most important tag in your HTML is the DOCTYPE. This is what will tell the browser how to deal with your page. Here’s an example of a full DOCTYPE:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

Here is a list of recommended DOCTYPEs and a great article from Alistapart that explains how to fix your site with the right DOCTYPE.

A title

Please don’t forget to put the title tag in your HTML document.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <title>Some title</title>
    ......

How embarrassing is it to have Untitled Document as the title of your site.

Proper encoding

Make sure you have proper encoding for your site.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <title>Some title</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    ......

It is recommended to either use ISO 8859-1 or UTF-8 if the content of your site will be in the english language. Use ISO 8859-15 if you need characters like the Euro sign and UTF-16 if you are writing in an Eastern Asian language like Chinese or Japanese.

Adhere to your DOCTYPE

If you are using an XHTML DOCTYPE, make sure you don’t forget the little things like closing empty elements (img, br, etc…) that differentiates XHTML from HTML.

Indent your code

It’s very easy to get lost in your mark-up when you don’t indent it properly. When everything is in one line, it’s hard to notice if the element is properly closed or missing.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <title>Some title</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

<div id="header">
    <h1>Welcome to my site</h1>
</div>

<div id="main">

    <div id="content">
        <h2>Content</h2>
        ........
    </div>

    <div id="sidebar">
        <h2>Sidebar</h2>
        .........
    </div>

</div>

</body>
</html>

Comment your code

An easy thing to do so you can find yourself quicky in your code

Use the proper element for the job

This ties in with making your CSS efficient but it’s also important to use the proper element for displaying the information. If you are displaying tabular data (like a calendar) use the table element. If you are displaying a title, use the proper heading element (h1, h2, … h5). No need for a tag soup of divs and classes to complicate things.