What is HTML?

The HyperText Markup Language, or HTML, is the standard markup language for documents meant to be displayed by a web browser.
It consists of tags(example: <p>) that surround the text and tell the browser to display it in different ways.
It works with CSS to modify the style of text and JavaScript to make the text interactive.

Elements

What are elements?

Elements are mostly declared with an opening and closing tag, for example: <p>text</p>
Elements can contain text and/or other elements, for example: <span>text <p>more text</p> </span>
Elements can have attributes, which are declared inside the opening tag. For example: <p attribute="value">text</p>
Some elements do not need a closing tag.

Types of elements

Paragraph element

The simplest element is the <p> element, which represents a paragraph.
Most text on a webpage is contained in a <p> element.
It does not affect the text, other than adding a margin space between subsequent paragraphs, like this:
line 1(not in a paragraph)
line 2(not in a paragraph)

paragraph 1, line 1
paragraph 1, line 2

paragraph 2, line 1
paragraph 2, line 2

Headers: <h1>,<h2>,<h3>,<h4>,<h5>,<h6>

The header elements represent headings or subheadings. They come in 6 levels, and the font size decreases on each level.
<h1> is typically used for the title, <h2> is typically used for section headings, etc.
These elements also have a large margin space.

<h1>

<h2>

<h3>

<h4>

<h5>
<h6>

Lists

HTML supports ordered(<ol>) and unordered(<ul>) lists. They are declared like any other element.
To add an item to the list a lt;li> element is created within the list element, like this:
<ul>
<li>Item 1<\li>
<li>Item 2<\li>
<\ul>
An example of both types of lists follows:

  1. This is an ordered list
  2. Numbers go before each list item
  3. There is some extra space between each list item
  4. The list items are also indented

Formatting elements

Several elements exist for formatting:
The <center> element causes elements that it contains to be centered horizontally, like this:

Centered Text

The <strong> element causes its contents to be bold, like this:
Bold Text
The <em> element causes its contents to be italic, like this:
Italic Text
There are also two elements that have special uses: <div> and <span>.
These elements do not change the text in any way, they are used as container elements.
For example: if you wanted to have one word in a line be red, you would use a <span> element and use CSS to make the span red.

Miscellaneous elements

Some elements that are useful to know are:

Types of attributes

Elements can have many different attributes.

Basic structure of a webpage

The basic structure of a webpage is as follows: mouse over the tags to see what they do.

For mobile users, click here to show the tooltips.

The bare minimum:

<!DOCTYPE html>

<html>

 <head>

  <meta charset='utf-8'>

  <title>Webpage Title</title>

 </head>

 <body>

  text

 </body>

</html>