Well, HTML is a text-based "language" that tells a browser how to display things. So no compiler or interpreter is needed to read or create the files, a simple text editor like Notepad will do. The only difference is that if you use Notepad you have to take care not to name your file (somefilename).TXT, but (somefilename).HTM or (somefilename).HTML. That's right, you can choose.
Can you really choose? Well, let's say it depends. If you have only one "mydog" file, calling it mydog.htm or mydog.html doesn't make any difference. But you can have index.html Ã nd index.htm on your site... If you link to the filename there's no problem, but if you don't then you depend on the webserver-software you happen to be using. There will be an order, so it may be so that on one server the html file will be shown as the default, on the other the htm file.
Basically it all comes down to being organised. You shouldn't have two files with the same name, full stop. Even if they have a different extension.
And what about the filename itself, regardless of the extension? Most modern browsers and webservers will forgive you, but you shouldn't really use spaces, dots, commas, and other odd characters in any filename on a webserver. Just a-z, 0-1, - or _ and nothing more. What about UPPER or lowercase? Up to you. Just remember that for a webserver there is a difference between Mydog.htm and mydog.htm and MYDOG.HTM and mydog.HTM, they are all different files. If you want to make life easy for yourself, just use always lowercase, that way you just need to remember the filename, and not it's case.
Okay then, what should be in an HTML file? The content of course is up to you, but you should follow a basic structure:
Code: Select all
<html> <head> <title>This is the title of your page</title> </head> <body> </body> </html>
But using an indent, just like in programming, helps you to see which parts belong together, they will show some kind of hierarchy.
So, the parts...
<html>...</html> indicates that those are the boundaries of your page. There should be nothing before <html>, and nothing behind </html>. One exception: the "Doctype" declaration - but I wouldn't worry about that now. Everything else, every HTML tag, every script, everything should be between those two boundaries.
Inside those boundaries you notice two marjor blocks:
<head>...</head> This has nothing to do with a heading, but everything with "invisible information about your page". Keywords, some scripts, and other information goes here.
<body>...</body> This container, err, contains the visible information. Text, images, lines, colors, all of that goes here. More info in this thread about the Body-tag.
<title>...</title> Look at the top of this window. In the title-bar of your browser you read "Gostats.com free hit counters :: View Topic - HTML Basics". That's the title of this page. Don't confuse this with a title on the page itself: since it is in the Head-section it belongs to the invisible info. Huh? But I can see it? Yes, but not on the page itself. Your browser shows it in the title bar, and if you add this page to your favourites the Title-tag is used as well. Search-engines will also use this title-tag, so be very careful and pick the right words. Just for fun search the web and see how many people have a page called New Page 1 or other irrelevant info.
One last thing: of all the elements you see in this basic structure there should be exactly one, no more, no less. So no two <body> tags, as so often happens when people copy-and-paste scripts without thinking.