What is HTML?
HTML stands for Hypertext Markup Language. HTML is the standard language for creating the webpages. HTML extend from another older markup language SGML (Standard Generalized Markup Language), which was used in document publishing. HTML uses tags to provide formatting features like: <i>this is italic</i>. There is a difference between first and last tag; the last tag has a slash(/) to indicate that it's a closing tag. HTML tags such as <br> and <img> did not have ending tags because the <br> just rendered a line break, and the <img> tag just rendered an image.
HTML versions timeline
1995: HTML 2.0
1997: HTML 4.0
1998: HTML 4.0 was reissued with minor edits without incrementing the version number.
1999: HTML 4.01
2014: HTML5
2016: HTML 5.1
2017: HTML 5.2
HTML document structure
Every HTML document should have a basic structure that consists of a <!DOCTYPE html> declaration, which historically has indicated the version of HTML to the browser. Next is the root <html> element, which contains the <head> element and the <body> element. The <head> element contains hidden information such as metadata that describes the HTML document and instructions. The following is an example of metadata in the <head> element.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>title here</title>
</head>
<body>
content here
</body>
</html>
What is semantic markup?
Semantic HTML is a way of writing HTML that emphasizes the meaning of the encoded information over its presentation. Semantic is defined as the study of the meaning of linguistic expressions. In the context of HTML, that means that tags provide meaning to the content in the HTML document. Tags do not provide a presentation; they provide meaning. HTML tags provide a meaningful structure but do not provide the presentation. Remember that separation is accomplished by providing structure in your HTML5 document, maintaining presentation in your CSS3 style sheet, and maintaining the behavior in your JavaScript file. Semantic HTML or semantic markup is HTML that introduces meaning to the web page rather than just presentation. For example, a <p> tag indicates that the enclosed text is a paragraph. This is both semantic and presentational because people know what paragraphs are and browsers know how to display them. On the flip side of this equation, tags like <b> and <i> are not semantic, because they define only how the text should look (bold or italic) and do not provide any additional meaning to the markup. Examples of semantic HTML tags include the header tags <h1> through <h6>, <blockquote>, <code> and <em>. There are many more semantic HTML tags that can be used as you build a standards-compliant website.
Adding comments
You can add comments to your HTML source by using the following syntax.
<!--comment here -->
Comments are not displayed on the rendered browser page but are sent to the browser. Comments can help document your source.
Adding conditional comments
Only Internet Explorer recognizes conditional comments, which enable you to add a browser-specific source that executes if the browser is Internet Explorer but is treated as a comment by other browsers. You can add conditional comments to your HTML document by using the following syntax.
<!--[if lte IE 7]> <![endif]-->
<!--[if lt IE 7]> <![endif]-->
<!--[if IE 8]> <![endif]-->
<!--[if gt IE 8]> <![endif]-->
<!--[if gte IE 9]> <![endif]-->
<!--[if !IE]> --> <!-- <![endif]-->
HTML Element reference
HTML5 has more than 100 defined elements that you can use to create rich webpages and applications. The W3C defines the following list of these elements with a brief description. Note that brevity is a substitute for 100 percent accuracy in these descriptions.
• <a> Hyperlink
• <abbr> Abbreviation
• <address> Contact information
• <area> Image map region
• <article> Independent section
• <aside> Auxiliary section
• <audio> Audio stream
• <b> Bold text
• <base> Document base URI
• <bb> Browser button
• <bdo> Bi-directional text override
• <blockquote> Long quotation
• <body> Main content
• <br> Line break
• <button> Push button control
• <canvas> Bitmap canvas
• <caption> Table caption
• <cite> Citation
• <code> Code fragment
• <col> Table column
• <colgroup> Table column group
• <command> Command that a user can invoke
• <datagrid> Interactive tree, list, or tabular data
• <datalist> Predefined control values
• <dd> Definition description
• <del> Deletion
• <details> Additional information
• <dfn> Defining instance of a term
• <dialog> Conversation
• <div> Generic division
• <dl> Description list
• <dt> Description term
• <em> Stress emphasis
• <embed> Embedded application
• <fieldset> Form control group
• <figure> A figure with a caption
• <footer> Section footer
• <form> Form
• <h1> Heading level 1
• <h2> Heading level 2
• <h3> Heading level 3
• <h4> Heading level 4
• <h5> Heading level 5
• <h6> Heading level 6
• <head> Document head
• <header> Section header
• <hr> Separator
• <html> Document root
• <i> Italic text
• <iframe> Inline frame
• <img> Image
• <input> Form control
• <ins> Insertion
• <kbd> User input
• <label> Form control label
• <legend> Explanatory title or caption
• <li> List item
• <link> Link to resources
• <map> Client-side image map
• <mark> Marked or highlighted text
• <menu> Command menu
• <meta> Metadata
• <meter> Scalar measurement
• <nav> Navigation
• <noscript> Alternative content for no script support
• <object> Generic embedded resource
• <ol> Ordered list
• <optgroup> Option group
• <option> Selection choice
• <output> Output control
• <p> Paragraph
• <param> Plug-in parameter
• <pre> Preformatted text
• <progress> Progress of a task
• <q> Inline quotation
• <rp> Ruby parenthesis
• <rt> Ruby text
• <ruby> Ruby annotation
• <samp> Sample output
• <script> Linked or embedded script
• <section> Document section
• <select> Selection control
• <small> Small print
• <source> Media resource
• <span> Generic inline container
• <strong> Strong importance
• <style> Embedded style sheet
• <sub> Subscript
• <sup> Superscript
• <table> Table
• <tbody> Table body
• <td> Table cell
• <textarea> Multiline text control
• <tfoot> Table footer
• <th> Table header cell
• <thead> Table head
• <time> Date and/or time
• <title> Document title
• <tr> Table row
• <ul> Unordered list
• <var> Variable
• <video> Video or movie
• <wbr> Optionally break up a large word at this element
Adding attributes in HTML elements
HTML Element can contain additional data in the form of attributes. An attribute is a name='value' pair which name is unique within the tag and value is always enclosed by single or double quotes.
Example: <input type="text" name="first-name" class="input-name">
Boolean attributes:
Some examples of Boolean attributes are as follows.
• checked Used with the checkbox and option button to indicate selection
• selected Used to indicate which option is selected in a drop-down or select list
• disabled Used to disable input, text area, button, select, option, or opt, group,
• readonly Used to prevent the user from typing data into a textbox, password, or textarea
Example: <input type="checkbox" name="vehicle" value="Bus" checked />
HTML5 attributes refrence
• class Used with CSS to specify one or more class names for an element.
• id Specifies a unique id for an element.
• style Specifies an inline CSS style for the element.
• title Provides extra information about the element.
• tabindex Sets the tabbing order of the element.
• spellcheck Used with the lang attribute to enable you to indicate whether the element is to have its spelling and grammar checked.
• lang Specifies the language (English, French, German, and so on) of the element’s content.
HTML void elements
Some HTML elements cannot have content. These are called void elements. For example, the <br> tag create a line break and cannot have any content.
void elements refrences:
• <area> Defines a hyperlink area with some text in an image map
• <base> Specifies the document’s base URL or target for all relative URLs in the document
• <br> Represents a line break
• <hr> Specifies a thematic change in content
• <img> Defines an image
• <input> Defines a typed data field that allows the user to edit the data
• <link> Defines a relationship between a document and an external resource such as a cascading style sheet
• <keygen> Defines a key-pair generator control for forms that is used to encrypt data that will be passed to the server
• <meta> Defines metadata that describes the HTML document
• <source> Defines a multimedia resource for a <video> or <audio> element