Some HTML Basics

Posted On: 2009-08-24

Being a webmaster and building websites has never been easier. These days there are plenty of very sophisticated tools out there that you can use to build websites and you don't even need to have a clue about the hyper text markup language that forms the code your pages are being built in.

That's not always been the case and many of us who have been around for a while ... probably longer than we care to admit ... first learned the art of building a webpage by writing all that HTML by hand ... in Notepad. Back then it certainly took a while to build a single page and it's not something I would like to have to try and do these days.

I'm sure that most of us who did learn to write HTML by hand could do it again if we had to but it's so much faster to use something like Dreamweaver or one of the other advanced tools that are out there. However, that doesn't mean that you don't have to learn the basics of HTML any more because even a basic understanding of the code that hides behind a web page is definitely worth having.

Now I'm not going to take you right back to the basics as they were when I first jumped into HTML but we are going to look at a couple of points in what passes as basics in HTML today. You may not think that it all that necessary because the HTML tools do everything for you but there are some things here that you should be aware of because no tool is 100% perfect and sometimes you can accidentally delete things from the code without realizing it.

Make sure your tags are closed
Ok, so this one is something that's very basic but it's something that is quite easy to screw up even with a good HTML editor. For every tag that you open ... with the exception of the image tag ... there has to be a closing tag.

So if you open a tag for a link make sure that there is a closing tag at the other end. For some reason I often seem to be able to delete that closing tag when I'm editing my code and then I'm left wondering why suddenly everything on the page is a link.

Locate your CSS files away from the page
I know that if you have a look at some of our older sites you will find that the style sheets for the site are located in the head tags of each page. It's something I/we shouldn't have done but back then we were new to CSS and didn't know any better. Yes, I know ... it's a lame excuse.

These days we always place our style sheets in their own file and call them up with a single line of text in the head tag ... it makes changing details across a site so much easier. And it's something you need to watch if you use an tool like Dreamweaver because that's one HTML editor that seems to like building the style sheets in the head tags for each page.

Understand that one size does not fit all
If you're new to HTML and style sheets one thing you need to understand is that no browser seems to render a page that uses CSS in exactly the same way. Firefox certainly does the best job of rendering CSS as the page designer intended while some versions of Internet Explorer that are still in use make an absolute mess of it.

Internet Explorer 6 is perhaps the worst offender when it comes to totally destroying a page design that depends on CSS and many people are just plain ignoring IE6. However, a lot of people still use IE6 ... especially in corporate situations ... so it's not something we here in adult should ignore.

Now that last statement may have you wondering but if you have a look at the peak periods for traffic on your sites you will see that the peak period is often during work hours ... yep corporate guys and gals still like to see their porn at work regardless of what the rules might be.

So what do you do to cater for IE6? If you want to incorporate something into your style sheet that won't work in IE 6 then you give IE6 its own style sheet that cuts out all those fancy bits it can't understand.

Javascript at the bottom please
Many adult traffic sources don't like linking to sites that include Javascript ... there are just too many sneaky things that you can do with Javascript but if you do use it for good purposes then either place it at the bottom of the code ... or call it from an external file.

Loading time on your page will be faster if you don't put the script in the head tags and calling it from an external source is even better. There's also the problem of what happens when a browser hits some Javascript in the head tags or in the body of the page and the script doesn't load properly.

What usually happens in that situation is ... basically nothing. The page either stops loading or doesn't display properly. If you place the script is at the bottom of your code, or call it from an external source, then at least the page loads in a form that can still be displayed by the browser.

And there are just a few of today's basics for people who are new to HTML.