Basic anatomy of HTML Webpage
In my previous article “What is HTML and what is it used for?” I tried to give an introduction about HTML. In this article I’ll go more deep about HTML.
Let’s start with an example. Following text is showing a HTML raw page and after that an image is showing the page in browser.
- <!DOCTYPE html>
- <title>Page Title
- <h1>My First Heading</h1>
- <p>My first paragraph.</p>
Now examine the raw page each item by their number:
- The DOCTYPE is a declaration that defines the type of document. Here type is HTML
- The text <html> describes that an HTML document is start from here.
- The text <head> describes that Heading is started from here and Heading provides information about the document
- The text <title> describes that Title is started from here and it provides a title for the document
- The text </title> describes that the title that we started at line 4 is closed.
- The text </head> describes that the head that we started at line 3 is closed.
- The text <body> describes that the body of the HTML content is started from here that will show page content to the viewer.
- As like line 4 and 5, The text between <h1> and </h1> describes a heading
- As like line 8, The text between <p> and </p> describes a paragraph
- The text </body> describes that the body that we started at line 7 is closed.
- As like line 10 </html> describes that the html that we started at line 2 is closed.
By the above description, a web browser can display a document with a heading and a paragraph. By this html tag, you can see pages in your browser.
Now a term comes that HTML tag. What is HTML tag? Well, so far we have used <head></head>, <h1></h1> etc. to describe our HTML document and all of these are HTML tag.
In formal definition: HTML tags are keywords (tag names) surrounded by angle brackets: <tagname>content</tagname>
You can find all the HTML tag by clicking this link.
Now let’s have a look about HTML page structure:
In the above picture only line 3 is visible by the browser and user will show only two lines and those are, “This is a Heading” and “This is a Paragraph”. Others are for browser to display the page in correct format.
So, now have you got the very simple idea about HTML. If you want to learn more about HTML then w3schools is the best.
Have a nice day.