Every HTML document must commence with a document type declaration: <!DOCTYPE html>
.
The HTML document itself starts with <html>
and concludes with </html>
.
The visible content of the HTML document is contained between <body>
and </body>
.
Example
<!DOCTYPE html> <html> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html> |
The <!DOCTYPE> declaration specifies the document type and assists browsers in rendering web pages accurately.
It should appear only once, at the beginning of the page (prior to any HTML tags).
The <!DOCTYPE> declaration is not sensitive to letter case.
The <!DOCTYPE> declaration for HTML5 is as follows:
<!DOCTYPE html> |
HTML headings are denoted by the <h1> to <h6> tags.
The <h1> tag represents the most significant heading, while <h6> represents the least significant heading.
Example
<h1>This is heading 1</h1> <h2>This is heading 2</h2> <h3>This is heading 3</h3> |
HTML paragraphs are specified using the <p> tag.
Example
<p>This is a paragraph.</p> <p>This is another paragraph.</p> |
HTML links are created using the <a> tag.
Example
<a href=”https://www.w3schools.com”>This is a link</a> |
The destination of the link is indicated within the href attribute.
Attributes are employed to furnish supplementary details about HTML elements.
You’ll delve deeper into attributes in a subsequent chapter.
HTML images are declared using the <img> tag.
Attributes such as source file (src), alternative text (alt), width, and height are included.
Example
<img src=”w3schools.jpg” alt=”W3Schools.com” width=”104″ height=”142″> |