HTML is not a programming Language BECAUSE it can't control the behavior of software & one can't generate his/her ideas using HTML.
A markup language consists of mark-up tags which tells the browser how to structure/display a particular document. WHILE HyperText refers to the process of linking one or more web pages with each other.
Web Pages can be created and modified by various HTML Editors like:
Steps for Creating a basic HTML Page
1. Open Editor(Notepad++)
2. Write the following HTML Code
3. Save the file with extension .html or .htm
4. Open the file in any web browser
How does Browser understands HTML
The main objective of web browser is present in the web resources required to you and display it in the browser window. Almost all the browsers follow these basic steps to provide you with the requested web resources.
The rendering engine gets the content of the requested document from the networking layer.
Different browsers use different rendering engines:
1. Internet Explorer uses Trident
2. Firefox uses Gecko
3. Safari uses Webkit
4. Chrome & Opera(from version 15) use Blink, a fork of Webkit.
It parses HTML to construct DOM(Document Object Model) Tree.
The DOM construction is incremental, meaning that the DOM construction is started as soon as the browser receives the HTML rather than waiting for the whole page to load.
It parses CSS(if available) to construct CSSDOM (CSS Object Model) Tree.
The CSS construction is not incremental,thus the page rendering is blocked unless whole of the CSS file is loaded.
The DOM contains all the content of the page.
The CSSDOM contains all the style of the page.
The DOM Tree and CSSDOM Tree are combined to form a Renderer Tree.It only captures the visible content.
Next comes the Layout step, where the positions and dimensions of the content in calculated according to the viewport(browser's) size.
The layout depends on the size of the browser so everytime when you change the orientation or change the size of the browser has to return the layout step.
The layout is then handed to the Paint which renders the pixel on the page.
The building blocks of HTML Pages are HTML Elements which contain three main parts:
- Opening Tag
- Closing Tag
These tags are enclosed within angle braces.
Opening Tag: This consists of the name of the element , wrapped in opening and closing angle brackets. It states where the element begins or start to take effect .
Content: This is the actual content.
Closing Tag:This is the same as the Opening Tag, except that it includes a forward slash before the element name .This states where the element ends.
Provide additional information about an element.They are always placed in start tag and they usually come in name-value pairs like name="value".
An attribute should have:
- A space between it and element name(or the previous attribute, if the element already has one or more attributes)
- The attribute name, followed by an equal sign.
- An attribute value, with openinng and closing quote marks wrapped around it.
An attribute value can be inside single or double quotes
Both are correct.
In some situations, when the attribute value itself contains double quotes, it is necessary to use single quotes:
A Link to my example
or vice versa
A Link to my example
Comment is a piece of code which is ignored by web browser.
In HTML comments are placed between <!-- -->
Advantages of writting comments
- It is used to describe how your code works, so that when you look into it after a long period of time and don't remember what it was for, comments can help you out in that situation.
- Whenever your code is being referred by someone else, he can quickly get the purpose of that block of code and the way it works.
You can't nest a comment i.e. putting comment inside a comment.
This code is incorrect.