Verious versions of HTML has been released, but still HTML basics remain the same. Below is the basic code, which is must for every webpage.
Here is the complete explanation of all the tags used in the above program.
<!DOCTYPE html> indicates that current version is HTML 5
<html> opening HTML root element
</html> closing HTML root element
These two in combine are used to wrap all the code. Most of the HTML elements has a closing tag like the above. You can compare these tags with the bread in a sandwich. As a sandwich has two slice of breads and everything else are wrapped with in that. Like a sandwich most html tags has an opening and closing tag and everything else are wrapped with in this. We learn about tags in detail in later chapters.
So from this point onward we will use only opening tag and it will refer to both the tags.
<head> : immediately following the opening HTML tag we will find the head tag. With in opening and closing head tags, all of the non visual elements like metadata, title, page CSS etc are present and these help make the web page work. We will learn about them one by one in our later chapters.
<body> : After head tag we will see the body tag. All visual elements are contained with in this tag. Means what ever we are seeing on the web page are contained with in this open and closing body tags. We will learn them one by one in our later chapters.
Check your progress :
Q) Most of the HTML tags has opening and closing tags.
Q) All HTML tags has opening and closing tags.
Q) HTML tags can be compared to the breads of a sandwich.
Q) HEAD contains non-visual elements.
Q) BODY contains visual elements.
Q) The elements which we want to display on web page should be placed with in body tags.
Q) A HTML document is divided mainly into 2 parts as Head and Body.