HTML - Basic Tags
What are HTML Tags
HTML Tags are special tags used in structuring content in an HTML document or web page.
Some of these Tags include the:
1. Heading tag,
2. Line-break tag,
3. Center tag,
4. Paragraph tag,
5. Division tag,
6. Section tag,
7. Horizontal line tag e.t.c
Heading Tags
Every document always begins with a heading. You can make use of various sizes for writing your headings.
HTML has mainly six sizes of headings, which are: <h1>, <h2>, <h3>, <h4>, <h5>, and <h6>. When rendering or displaying any heading, the browser includes a single line before and another single line after that particular heading.
Example:
<!DOCTYPE html> <html> <head> <title>Heading Example</title> </head> <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>
In Your Notepad.html or FirstWeb.html. The above code will display as:
Paragraph Tag
The paragraph (<p>) tag provides a way to arrange your text into various paragraphs. Each paragraph of text have to go in between an opening <p> and a closing </p> tag. It should be done as shown below:
<!DOCTYPE html> <html> <head> <title>Paragraphing Example</title> </head> <body> <p>Here is a First paragraph of text.</p> <p>Here is a Second paragraph of text.</p> <p>Here is a Third paragraph of text.</p> </body> </html>
In Your Notepad.html or FirstWeb.html. The above code will display as:
Line Break Tag
Anytime you make use of the <br /> tag in HTML, anything that comes after it starts from the next line. This particular tag is an example of an empty HTML element, in which you do not need to open and close the tag, because there is nothing to go in between them.
The <br /> tag has space in between the characters' br and the forward slash. If you remove this particular space, older browsers will have trouble displaying the line break, and if you miss the forward-slash character and just make use of <br> it is not supported in XHTML.
Example
<!DOCTYPE html> <html> <head> <title>Line Break Example</title> </head> <body> <p>Hello<br /> You delivered your assignment ontime.<br /> Thanks<br /> Mahnaz</p> </body> </html>
Horizontal Lines
Horizontal Lines are mainly used for the purpose of visually breaking up sections of a document. The <hr> tag makes a horizontal line directly from the current position it was placed in the document right down to the right margin and it also breaks the line accordingly.
For example, if you want to give a line between two paragraphs, you can do it as shown below:
<!DOCTYPE html> <html> <head> <title>Horizontal Line Example</title> </head> <body> <p>This is paragraph one and should be on top</p> <hr /> <p>This is paragraph two and should be at bottom</p> </body> </html>