What are HTML tags

What are HTML tags

What are HTML tags?

HTML Tags are tags within a web page which is surrounded by angle brackets that tells the browser how the web pages should be displayed. Many of tags come in pairs like <p> and </p> The first tag in pairs is start tag and second closing tag is the end tag. The end tag is same as start tag but with a forward slash, now question is do all HTML tags come in pair ?

No there are so many tags that does not need for closing. Examples are given below :

<img> tag and <br> tags.

The <html> tag is a root of an HTML document which contains all HTML elements.

<!DOCTYPE> Defines the document type which means pages is written in HTML 5
<html>Defines root of an HTML document
<title>Defines a title for the web pages
<body>Defines the body area
<h1> to <h6> Defines headings tags for text
<p>Defines a paragraph
<br>Defines a single line break
<!--...-->Defines a comment that will not display in browser

Tags which is mostly used in form

<form>Defines an HTML form opening tag for user input
<input>Defines an input tag
<textarea>Defines a text area for multiline input control
<button>Defines a button to click or submit form
<select>Defines a drop-down tags to show list of element in select box
<optgroup>Defines a group of options in a select box
<option>Defines an option in a select box
<label>Defines a label for an <input> element
<fieldset>Grouping for html elements in a form

Common/Basic Tags

<img>Defines an image
<a>Create a hyperlink to load url
<ul>Defines a list which is in unordered format
<ol>Defines a list which is in ordered format
<li>Defines a item for list
<table>Defines a tag for table
<caption>Defines a caption for a table
<th>Defines a column text in bold format in a table
<tr>Defines a row for a table
<td>Defines a column in a table
<head>Defines head tags about the document
<style>Defines a tag for styling for a document
<script>Defines a tag for client side script

<marquee> tags is used for scrolling text or images in many format either vertically or horizontally with lots of settings.

The <h1> to <h6> tags are used for headings.<h1> defines the most important heading. <h6> defines the least important heading.

Examples of above tags :

1st Example :

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Example of Heading Tags</title>
  5. </head>
  6. <body>
  7. <h1>This is example of heading 1</h1>
  8. <h2>This is example of heading 2</h2>
  9. <h3>This is example of heading 3</h3>
  10. <h4>This is example of heading 4</h4>
  11. <h5>This is example of heading 5</h5>
  12. <h6>This is example of heading 6</h6>
  13. </body>
  14. </html>

2nd Example :

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Example for Paragraph Tag</title>
  5. </head>
  6. <body>
  7. <p>This is a test for first paragraph.</p>
  8. <p>This is a test for second paragraph.</p>
  9. <p>This is a test for third paragraph.</p>
  10. </body>
  11. </html>

3rd Example :

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Example for Unordered List</title>
  5. </head>
  6. <body>
  7. <ul>
  8. <li>expertphp</li>
  9. <li>demo.expertphp</li>
  10. </ul>
  11. </body>
  12. </html>

Attribute of Unordered list are :

  1. <ul type="square">
  2. <ul type="disc">
  3. <ul type="circle">

4th Example :

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Example for Ordered List</title>
  5. </head>
  6. <body>
  7. <ol>
  8. <li>expertphp</li>
  9. <li>demo.expertphp</li>
  10. </ol>
  11. </body>
  12. </html>

Attribute of Ordered list are :

  1. <ol type="1"> - Default as Number.
  2. <ol type="I"> - Upper-Case Numerals.
  3. <ol type="i"> - Lower-Case Numerals.
  4. <ol type="a"> - Lower-Case Letters.
  5. <ol type="A"> - Upper-Case Letters.

Phone: (+91) 8800417876
Noida, 201301