Making a better webpage
Once, we are done with showing your contents in browser. It sbeetter if we do the same thing in a well organized manner and browser can interpret it in a better way.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"> <html xmlns="http://www.w3.org/1999/xhtml"> <head>
My first webpage</head> <body>
This is my first webpage.</body> </html>
Although there will be no differnce in the output of the browser in both the ways of showing contents, but this one is more appropriate and will be vital when our contents increases and we need to beautify each of them in a different manner. Lets explain you the meaning of the above lines.
Starting with the doctype declaration, it is required because it validates your HTML document and informs browser about your file. Without this, browser switches to 'quirks mode' which means they decide by their own what to do with your code. They interpret the code in thier own manner. Many a times its absense lead to unusual representation of the contents.So, always remember to include those tags in your html file. If you cant remember for now, just bookmark this page and you will be refer to it any now and then until you learn it completely.
Meta tags are used to facilitate your availability in search engines. You dont need to bother about this too much. However, its a good practice to include those tags. First tag shown stores keywords about your webpage, while the discription tag describes the contents of the corresponding page. The contents visible in search engine results after the main header link is the content of the discription tag. So, people can easily come to know what you wanna convey if you use these tags.
Contents placed in the head tag are used to store the information about the page and is displayed on the browser.Title tag describes your page in few words.This is displayed on the title bar of the window.
At the end we have body tags where the actual contents of the webpage lies. We have placed the desired contents in a paragraph tag, which we will be describing later.
Hope by now you would have come to know about what a tag is. Almost every tag has an opening and closing point and in between the contents lies.
In the above example we have used three meta tags which differ only by their attributes. Can you guess what i am talking about.
Yeah , I am talking about the contents inside the opening tag like name , content etc which stores some values and as a result two same tags differ from each other. Later on, we will see how we can distinguish two tags of same types by giving them id and class.
Opening , closing tag along with it contents form an entity. This is called elements in HTML. Example We are showing two elements in the example below :-
My first Webpage// First element
My first content goes here// Second element
We will now see how can we play with our contents now