In this chapter, we will learn how to show some basic HTML examples.
In HTML, all documents must start with a document type declaration.
In HTML the document itself begins with
<html> and ends with
</html> and another part of the HTML document is between
<!DOCTYPE html> <html> <body> <h1>First Heading</h1> <p>first paragraph.</p> </body>
The <!DOCTYPE> Declaration
<!DOCTYPE> the declaration represents the document type and It helps the browser to display web pages correctly.
It declares only one time at the top of the page (before the HTML tags).
It is not case sensitive In the HTML5 version, we declare
<!DOCTYPE> but we cannot declare before version of HTML5 ( HTML4, HTML3 and below ).
HTML heading are defined with
The most important heading is
<h6> is the least important heading.
<!DOCTYPE HTML> <HTML> <body> <h1>This is heading 1</h1> <h2>This is heading 2</h2> <h3>This is heading 3</h3> <h4>This is heading 4</h4> <h5>This is heading 5</h5> <h6>This is heading 6</h6> </body> </html>
HTML paragraph is defined with the
<!DOCTYPE html> <html>
<body> <p> Paragraph Section </p> <p> Another Paragraph Section.</p> </body>
In HTML link are defined with the <a> tag. You have to put the path of the link inside
href is an attribute. Attributes tell us additional information about HTML. We will learn more about attributes in a later chapter.
<!DOCTYPE html> <html> <body> <a href="https://agyanadda.com/">This is a link</a> </body> </html>
In HTML images are defined with <img> tag.
<!DOCTYPE html> <html> <body>
<img src="asset/img/how-to-do-agyanadda.jpg " alt="agyanadda.jpg" width="100" height="100">
In the given above example the source file
(src), alternative text
(alt ), width and height are also attributes.
Note: The alt tag is helpful when the image is not found then the alt tag name shown in the browser. If the image is found then the alt tag name is not shown in the browser.
HTML Line Break In HTML the line break tag is used for the next line or break new line. It is an empty element that means there is no need to open and closing the tag.
<!DOCTYPE html> <html> <head> <title>Line Break Example</title> </head> <body> <p>Hello Hi<br/> I am Learning HTML<br/> Thanku so much</p>
In HTML the horizontal line tag
<hr> is used to break-up the section of the document. It creates a line from the current position.
<title>Line Break Example</title>
<p>I am Learning HTML Thank you so much</p>
How to view HTML Source code?
It is an interesting thing when you run your HTML code then you can see the result in the browser but if you want to see the source code of HTML then just right click and go to the inspect option you can see the source code.
You can also edit your HTML code and see their result in the browser.
It is very important to inspect HTML code. When you create a project then it will help you so much.
There are many tags we will learn in the next chapter.