HTML elements are the basic building blocks of the a webpage.
1. HTML elements are the most fundamental building blocks of any web document. The elements are identified by the browser which accordingly renders the contents of the element in the predefined way to the user.
2. All Tags have a predefined and a distinct meaning and control the structural properties of the webpage.
3. Though some HTML elements do have some presentational or cosmetic usage. The use of HTML elements for presentational and design purpose is increasingly discouraged.
4. For presentation and design purposes the Cascading style sheet(CSS) is used.It is also an ever evoling standard along with HTML, the latest versions is CSS3.
The Empty Elements.
1. No requirement to put any content within these elements.
2. Even though it means no sense to leave an element empty,but still its valid.
3. Eg:<code> </code> ,<div> </div> etc.
Example : Empty Elements DemoGive it a TRY! »
Self Closing Elements.
1.Empty elements can be expressed even well using Single tag or self closing tags.
2.The Start and the End tag are combined into one Stoke Character ( / ) , which implies the start of end character.The stroke is placed at the end of the Single tag.
3.Eg: <code/> , <br/> etc.
Example : Self Closing Elements DemoGive it a TRY! »
Note- In HTML5 you can write <br /> element as <br> and it remains perfectly valid and legal .
The Void Elements
1. Void Elements are expressed using a single tag ,its invalid to use any content within these elements.
2. There are two ways to use them,first is to use only the start tag eg: <hr>.Second is to start and end with Stoke Character ( / ). Eg: <hr /> . Both are legal and valid across all browsers.
Example : Void Elements DemoGive it a TRY! »
1. W3C recommends that first tag of every HTML5 document must be: <!DOCTYPE> before any other Tag.
2. <!DOCTYPE> elements lets the browser know that the document is encoded with HTML5 specifications. And processes the file in browser's standard mode or else it uses the quirks mode.
3. So using the <!DOCTYPE> is a confirmation upfront that the document is purely encoded with HTML specifications and nothing else.
Example : DOCTYPE Element DemoGive it a TRY! »
Note- Though HTML tags are not case sensitive, but the <!DOCTYPE> tag should always be in uppercase.