HTML is a standardized language used for structuring content on the web. Originally managed by the W3C, control later shifted to the WHATWG organization when the XHTML push by the W3C proved to be unsuccessful. HTML5 is the latest version and includes not only HTML but also other technologies like SVG and WebGL. Unlike previous versions, HTML5 is a living standard where modules are developed separately.

The Basics of HTML

HTML is used to structure content on the web. It can be generated using server-side applications, client-side JavaScript applications, or by saving content into HTML files. HTML files are organized using tags, which give meaning to the content. For example, the <p> tag is used to create paragraphs, while the <ul> and <li> tags are used to create unordered lists. When served by the browser, the tags are interpreted and rendered according to predefined rules and styles.

Tags vs Elements

In HTML, tags wrap content and give it meaning. Elements consist of opening and closing tags along with the content they wrap. Elements can also have attributes, such as the class and id attributes which are commonly used for styling and identifying elements in CSS and JavaScript.

Attributes

Attributes provide additional information to tags. They are specified in the opening tag using the key="value" syntax. Commonly used attributes include class and id, where class can hold multiple values separated by spaces. HTML is case-insensitive, and white space is collapsed by the browser’s CSS engine, so it’s important to use consistent syntax and indentation for better readability.

The Document Head

The <head> tag contains meta information about the document and is placed before the <body> tag. It includes tags such as <title> for specifying the page title, <script> for adding JavaScript code, <link> for linking external CSS files, <style> for inline CSS, and <meta> for specifying various meta information like character encoding, description, and robots directives.

The Document Body

The <body> tag contains the visible content of the web page. It can include various tags and elements like paragraphs, headings, lists, images, and more. HTML elements can be classified as block elements or inline elements. Block elements, such as <p> and <div>, create a new line and do not allow other elements to sit next to them. Inline elements, such as <a> and <span>, can sit next to other inline elements. Block elements can contain both block and inline elements, while inline elements can only be contained within block elements.

Understanding HTML and its basic building blocks is crucial for web developers. By using proper tags and best practices, you can structure and present content effectively on the web.