Open your text editor and type the following code. You don’t have to understand what any of it means at this point. This simple example is just to get you started.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/transitional.dtd"> <html> <head> <title>My Sample HTML Page</title> </head> <body> <h1>This is my first title</h1> <p>This is my first webpage paragraph bla bla!</p> </body> </html>
Note that the<!DOCTYPE> tag in the previous example doesn’t appear in lowercase like the rest of the tags. This tag is an exception to the XHTML rule and should appear in uppercase. In fact, you don’t have to specify a DOCTYPE at all to get your pages to work. The purpose of the DOCTYPE is to tell validators and browsers which specification your page was written to. It will be included in all examples, but you can leave them out if you like.
After you create your HTML file, save it to your hard disk. Remember that the best way to learn is to type your code and use a simple text editor such as Notepad but if you’re using a word processor like Microsoft Word, choose Save As and make sure that you’re saving it as “Text Only”. When you choose a name for the file, follow these two rules:
Now that you have an HTML file, start your web browser. You don’t have to be connected to the Internet because you’re not going to be opening pages at any other site. Your browser or network connection software might complain about the lack of a network connection, but you should be able to work offline.
When an HTML page is parsed by a browser, any formatting you might have done by handthat is, any extra spaces, tabs, returns, and so onis ignored. The only thing that specifies formatting in an HTML page is an HTML tag. If you spend hours carefully editing a plain text file to have nicely formatted paragraphs and columns of numbers but don’t include any tags, when a web browser loads the page, all the text will flow into one paragraph. All your work will have been in vain.
The advantage of having all white space (spaces, tabs, returns) ignored is that you can put your tags wherever you want. The following examples all produce the same output. Try them!.
genuinely a fantastic post. I will definitely be reading this blog more.