A tag is a label attached to someone or something for the purpose of identification or to give other information. In HTML a tag is command inserted in a document that specifies how the document, or a portion of the document, should be formatted. HTML tags follow a simple but strict syntax: Opening angle bracket<Tag Name Attributes (optional) Closing angle bracket>Note: / in the closing tag! All closing tags must have this slash.A few examples: <title>HTMLpage</title> <meta charset="utf-8"> <img src="myPicture.png" alt=""HTML tagsHTML provides nearly 140 tags to provide the browser with semantics, or rules for interpreting and displaying the content. Among other things, tags can provide metadata for the HTML document, emphasize certain phrases (such as with italics), add media content, or display forms. Here are a few of the most common tags:<h1>, <h2>, <h3>, <h4>, <h5>, <h6>These tags define headings, ranging from h1 for the most general heading to h6 for the most specific.<p>This is the paragraph tag, used to create paragraphs, which are usually separated by line breaks.<a>...specifies an anchor. This tag is used to create a link to external resources such as a different webpage, an email, an image,a different section of the current document, and so on. The <a> tags enclose the text representing the link and the href attribute is used to define the target URL of the link: <a href="target_url">some text that the<img>This tag embeds an image in the HTML document. Here's an example of how to use it: <img src="url/to/my/image.png" alt=""><div> and <span>These tags don't have a specific meaning, they just separate sections within the document. We use these tags often for styling and scripting (which we'll discuss later on).<ul>, <ol> and <li>Those tags are used to create lists. <ul> defines a unordered list, <ol> defines an ordered list, and <li> defines a list item within a list element. Here's <ul> in action: <ul&g <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ul>
Void (Single) TagsThe open and close tag format dominates the majority of the available HTML tags, but there are tags that stand alone like<hr>This command gives you a line across the page - horizontal rule.<br>This breaks the text - starts it again on the next line. <img src="picture.gif" alt="picture" height="52" width="72">
DoctypeThe doctype is a formal declaration, placed at the very start of an HTML document, that the document is a standard HTML document. It looks like this:<!DOCTYPE html>
CommentsComments are notes you put in your HTML document for your own needs. The browser does not show comments to the user.<!--This is a comment. It won't show up in the browser.-->
An example of superscripted Text An example of<sup>superscripted Text</sup>An example of subscripted Text An example of<sub>subscripted Text</sub>An example of
struckthrough TextAn example of<del>struckthrough Text</del>
<pre>stands for previously formatted text. Spaces, tabs, and line breaks that exist in your actual code will be preserved with the <pre> tag. <pre> Line 111111111111111111 22222222222222 333333 4444 </pre>Line 111111111111111111 22222222222222 333333 4444
<b>defines bold text, without any extra importance.<strong>defines strong text, with added semantic "strong" importance.<i>defines italic text, without any extra importance.<em>defines emphasized text, with added semantic importance.
This text is bold.
This text is italic.Browsers display <strong> as <b>, and <em> as <i>. However, there is a difference in the meaning of these tags: <b> and <i> defines bold and italic text, but <strong> and <em> means that the text is "important"HTML Computer Code Elements<code>Defines programming code<kbd>Defines keyboard input<samp>Defines computer output<var>Defines a variable<pre>Defines preformatted texHtml5 tags