HTML Basic Syntax in Hindi / Urdu
HTML Document Structure: An HTML document is structured using opening and closing tags. The document starts with the <html> tag and ends with the </html> tag. The content of the document is divided into two main sections: the <head> and the <body>. The <head> section contains metadata and information about the document, while the <body> section contains the visible content of the webpage.
Elements and Tags: HTML uses elements to define different parts of a webpage. Elements are represented by tags enclosed in angle brackets. There are two types of tags: opening tags and closing tags. The opening tag denotes the beginning of an element, and the closing tag denotes the end. For example, the <h1> tag represents a heading, and it is closed with the </h1> tag.
Attributes: Elements can have attributes, which provide additional information about the element. Attributes are specified within the opening tag and consist of a name and a value, separated by an equals sign. For example, the <img> element has an attribute called src to specify the source URL of an image.
Nesting Elements: Elements can be nested inside other elements to create hierarchical structures. The nested elements must be properly opened and closed within their parent elements.
Text Content: Text content within HTML elements is usually placed between the opening and closing tags of an element. For example, <p> tags are used for paragraphs, and the text content goes between the opening <p> and closing </p> tags.
HTML Documents
All HTML documents must start with a document type declaration: <!DOCTYPE html>
.
The HTML document itself begins with <html>
and ends with </html>
.
The visible part of the HTML document is between <body>
and </body>
.
html
head
title Amazing Cats - A YouTube Video /title
/head
body
/body
/html
The <!DOCTYPE> Declaration
The <!DOCTYPE>
declaration represents the document type, and helps browsers to display web pages correctly.
It must only appear once, at the top of the page (before any HTML tags).
The <!DOCTYPE>
declaration is not case sensitive.
The <!DOCTYPE>
declaration for HTML5 is:
!DOCTYPE html
HTML Headings
HTML headings are defined with the <h1>
to <h6>
tags.
<h1>
defines the most important heading. <h6>
defines the least important heading:
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>