What are Tags?
Different Type of HTML Tags
HTML consists of tags. There are roughly 54 tags that make up HTML (off course depending upon the version of HTML this may vary). These tags can be divided into essentially two types of HTML tags i.e. tags that need to have associated closing tags or tags that do not require closing tags.
HTML tags are case insensitive, however, it is good practice to use lowercase for tags. Unrecognized tags are simply ignored by the browser. When using closing tags please ensure that they are nested together (more coming on what are nested tags)
Given below are examples of both these types of tags.
<html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>test</title> </head> <body> <a href="#"> This is an example of anchor tag</a> <p> This is an example of paragraph tag</p> <br/> this is a line break tag. <hr/> this is a horizontal rule tag </body> </html>
This is how above HTML will appear in firefox browser.
Examples of closing tags
<a href="#"> This is an example of anchor tag</a> <p> This is an example of paragraph tag</p>
Examples of non-closing tags
<br/> this is a line break tag. <hr/> this is a horizontal rule tag
List of all HTML tags
Document Structure Tags
<html></html> Creates an HTML document <head></head> HTML document header related tags <body></body> body of the document i.e. actual contents
Text Tags
<pre></pre> Creates preformatted text <hl></hl> headline largest <h2></h2> <h3></h3> <h4></h4> <h5></h5> <h6></h6> headline smallest <b></b> bold text <i></i> italic text <tt></tt> teletype, or typewriter-style text <cite></cite> citation, usually italic <em></em> Emphasizes a word (with italic or bold) <strong></strong> Emphasizes a word (with italic or bold) <font></font> Sets size of font
Table Tags
<table></table> Creates a table <th></th> insert table heading <tr></tr> insert a table row <td></td> insert a table cell