Basic Tags of HTML
Posted in HTML Tutorials | Email This PostHere you can learn about the tags which are commonly used.
Paragraph <p>: Paragraph Tag is used to begin a new paragraph i.e. it tells the browser to insert a empty line and then begin with a new line.A simple example
<html> <head> <title> My first web page </title></head> <body> <p>HTML is Hyper Text Markup Language</p> <p>HTML is Easy</p> </body> </html>
Output:
Line Break <br>: Line Break Tag as name indicates it is used to tell the browser that the line has ended. BR is an Example of single tags in HTML (Tags which do not have ending tags)
Horizontal Rule <hr>: Horizontal Rule Tag will give you a thin black line across the page.
It has few basic elements.
1) Size: it sets length of the horizontal rule in pixels or in % of page width.
2) Align : it aligns the horizontal rule to left, right, and center.
3) Width: It specifies the width of the horizontal rule.
Sample Program:
<html> <head> <title>Program</title></head> <body> <p>Statement<br>can<br>be<br>broken <br>using line break tag <hr align =left size="2" width="50%" > <p> Web Page can be divided using horizontal rule tag </body> </html>
output:
Heading :
There is tag for various headings in HTML known as Heading tag ranging from h1 to h6 where h1 is for most important and h6 is for least important.
Example:
<html> <head> <title> Heading Example </title></head> <body> <h1>Heading tag </h1> <h2>Heading tag </h2> <h3>Heading tag </h3> <h4>Heading tag </h4> <h5>Heading tag </h5> <h6>Heading tag </h6> </body> </html>
Output:
Hyperlinks
Hyperlinks commonly used as links are used to toggle between the Web Pages.
To create a hyperlink, href attribute is used and the url is given as input to the attribute.
Example:
<html> <head> <title> My web page using hyperlink </title></head> <body> <a href="https://codingmanuals.com/html-tutorials/formatting-tags/"> Learn Formatting </a> </body> </html>
HTML Images
To embed or add an image to the webpage we use tag
Example:
<html> <head> <title> My web page using image</title></head> <body> <img scr="https://codingmanuals.com/wp-content/uploads/2010/08/wp.jpg" alt="inspiring quote"/> </body> </html>
HTML Comments
Comments gives a brief description of code which makes it easier to understand.Comments are never displayed on browser, those are only for user’s understanding.Comments are written as:
Example:
<html> <head> <title> comment example</title></head> <body> <p>This is how a comment can be written <!--this is an example of comment --> </body> </html>