Wednesday, July 14, 2010

Basic HTML for beginners

For this post I'd like to touch on the most basic concepts of writing HTML. I'll try to keep this short and sweet.

First - use a text editor or html editor. Notepad is good, Wordpad is bad. Word is bad. I personally like to use Notepad++ or JEdit. Both of these are great editors and add many features that I can't live without now, like syntax highlighting.

Second - Close all tags. Get in the habit of closing all tags. It's easiest to remember if you do this when you open the tag. Some editors automatically insert the closing tag one the opening tag is typed in. An example of an opening tag is <html>. The closing tag for this opening tag looks like this </html>. Another example of an opening and closing tag would be <b></b>. There are special cases where tags can self-close. An example of this would be the page break tag <br />. Most browsers will interpret <br> just fine but it's not w3c compliant any longer. It needs to be self closed. To self close a tag such as this, you just add a space and a forward slash like <br />. If it doesn't make sense to wrap an opening and closing tag around something, then it is probably a self closing tag.

Third - Use a doctype. At first this doesn't seem at all important because the code will work without it, and let's face it, these things are difficult to remember usually. Though, HTML5 has a simple doctype of:
<!doctype html>
Using a doctype will tell the browser how to handle certain nuances in the code.

Lastly - Learn good SEO from the start. Learn to utilize keywords within your title, meta keywords, meta description, and heading tags. Learn to do good page interlinking within your site. Learn to use good keywords in your anchor tag text.

These are some of the things to keep in mind when starting to learn HTML.

No comments:

Post a Comment