What are HTML Tags

What are HTML Tags?

Consider this example
  1. <html>
  2. <head>
  3. <title>Your page title</title>
  4. </head>
  5. <body>
  6. <!-- An HTML comment which is not displayed on the web page -->
  7. <h1>Your page heading</h1>
  8. <p>Your page content in a paragraph.</p>
  9. </body>
  10. </html>
The words <html><head><title></title></head><body><h1><p></p>,</h1></body></html> etc., are called HTML Tags.
The words <html><head><title><body><h1><p> etc., are called opening tags / start tags.
The words </html></head></title></body></h1></p> (with a back slash /) etc., are called closing tags / end tags

What is the syntax to write an HTML Tag?

HTML Tags are not case sensitive and you are free to use both uppercase or lowercase tags or a combination of both. Now a days many websites use lowercase tags and for future specifications (versions) of HTML it is recommended to use lowercase tags.
Any number of line breaks and spaces in a HTML document are treated as a single space character (exception: <pre></pre> tag).

  1. <p>Your page content in a paragraph.</p>
  1. <p>
  2. Your page content in a paragraph.
  3. </p>
  1. <p>
  2. Your page
  3. content in a paragraph.
  4. </p>
  1. <p>
  2. Your page
  3. content in a paragraph.
  4. </p>
  1. <p>
  2. Your page
  3. content
  4. in a paragraph.
  5. </p>
The ouput of all the above codes is same.

List of some commonly used HTML Tags

Please note that the default display of elements will be different from our examples as we use various CSS to style our web page
<a>Anchor tag is used to display hyper linksThis is a link
<b>This tag makes the text inside it boldThis is a bold text
<body>This defines the body of a HTML documentThis tag is found in each and every web page
<br />Introduces a line break in the web page.
It is an empty element which has no closing tag
line 1 
line 2
<button>Creates a clickable button (mostly used in forms)
<div>Used to organise content into divisions (sections)Extensively used in almost all web pages
<em>Emphasizes text inside itThis text is emphasized
<form>Used to submit data using input tagsView forms demo
<frame>Creates a frame which is like a sub-windowView frames demo
<h1> to<h6>Heading tags are used to define the heading of a page


in a <h2> tag
<head>Contains the information of a dcoument like page's titleView example
<hr />Similar to <br /> tag but introduces a horizontal lineline 1 

line 2
<html>It is the root of any HTML documentIt is found in every html document
<i>Makes the text inside it italicizedThis is an italic text
<iframe>Creates an inline frameView iframes demo
<img />Image tag is an empty tag used to insert images
<input />An empty element used to input data
<label>Acts as a label for an input
<li>Display an item of a list (ordered and unordered)

  • Item 1
  • <ol>Make an ordered list of items
    1. Item 1
    2. Item 2
    <p>Display content in a paragraphThis is a paragraph
    This is another paragraph
    <span>Define a section in a documentUsed to style different sections in an element
    <strong>Make the text look more importantThis is a strong text
    <table>Create a tableYou are already viewing this in a table
    <td>Display a table cellThis text is in a table cell
    <tr>Create a table rowThese three cells of the current line form a row
    <ul>Make an unordered list of items
    • Item 1
    • Item 2
    www.cinterviews.com appreciates your contribution please mail us the questions you have to cinterviews.blogspot.com@gmail.com so that it will be useful to our job search community

    No comments: