HTML Course | Structure of an HTML Document
As we all know HTML is a language of the web. It’s used to design the web pages or we can say structure the page layouts of a website. HTML stands for HYPERTEXT MARKUP LANGUAGE, as its full form suggests it’s not any programming language, a markup language. So, while the execution of HTML code we can’t face any such error. In real HTML code wasn’t compiled or interpreted because HTML code was rendered by the browser. which is similar to the compilation of a program. Html content is parched through the browser to display the content of HTML.
HTML DOCUMENTS STRUCTURE
Html used predefined tags and attributes to tell the browser how to display content, means in which format, style, font size, and images to display. Html is a case insensitive language. Case insensitive means there is no difference in upper case and lower case ( capital and small letters) both treated as the same, for r example ‘D’ and ‘d’ both are the same here.
There are generally two types of tags in HTML:
- Paired Tags: These tags come in pairs. That is they have both opening(< >) and closing(</ >) tags.
- Empty Tags: These tags do not require to be closed.
Below is an example of a (<b>) tag in HTML, which tells the browser to bold the text inside it.
Tags and attributes: Tags are individuals of html structure, we have to open and close any tag with a forward slash like this <h1> </h1>. There are some variations with the tag some of them are self-closing tag which isn’t required to close and some are empty tag where we can add any attributes in it. Attributes are additional properties of html tags that define the property of any html tags. i.e. width, height, controls, loops, input, and autoplay. These attributes also help us to store information in meta tags by using name, content, and type attributes. Html documents structured mentioned below:
An HTML Document is mainly divided into two parts:
- HEAD: This contains the information about the HTML document. For Example, the Title of the page, version of HTML, Meta Data, etc.
- BODY: This contains everything you want to display on the Web Page.
Let us now have a look at the basic structure of HTML. That is the code that is a must for every webpage to have:
Every Webpage must contain this code. Below is the complete explanation of each of the tags used in the above piece of HTML code:
<!DOCTYPE html>: This tag is used to tells the HTML version. This currently tells that the version is HTML 5.0
<html> </html> : <html> is a root element of html. It’s a biggest and main element in complete html language, all the tags , elements and attributes enclosed in it or we can say wrap init , which is used to structure a web page. <html> tag is parent tag of <head> and <body> tag , other tags enclosed within <head > and <body>. In <html > tag we use “lang” attributes to define languages of html page such as <html lang=”en”> here en represents English language. some of them are : es = Spanish , zh-Hans = Chinese, fr= french and el= Greek etc.
<head>: Head tag contains metadata, title, page CSS etc. Data stored in the <head> tag is not displayed to the user, it is just written for reference purposes and as a watermark of the owner.
<body>: A body tag is used to enclose all the data which a web page has from texts to links. All the content that you see rendered in the browser is contained within this element. Following tags and elements used in the body.
1 . <h1> ,<h2> ,<h3> to <h6>
3. <div> and <span>
4. <b>, <i> and<u>
6. <img> , <audio> , <video> and<iframe>
7. <table> <th> , <thead>and<tr>.
9. <label> and <input> others……….
To learn more about an HTML Document structure, please visit: