What is a markup language? HTML Reference Cheatsheet.
A markup language is a system of annotating a document. It usually wraps around a particular bit of text with a pair of <> and </> brackets. The <> signifies the beginning of the markup and </> marks the end.
Here is an example of what markup looks like for HTML:
<h1>Hello, I am a title</h1>
The major difference between XML and HTML is that XML is more flexible. You can call your tags whatever you want. HTML comes with a list of predefined tags that you can use.
Here is a list of commonly used HTML tags, categorized by type. If all this is new, you don't have to memorize any of the tags below. Rather, use it as a starting reference point to get you thinking about how to structure your HTML page based on the elements and what they do.
<h1> <h2> <h3> <h4> <h5> <h6>
<h1> - <h6> represents the different levels of headings. You can use CSS to decorate them differently. It also lets search engines know the importance of each content type on your page. For example, <h1> is the most important heading on your page and is generally used only once, followed by sub-headings marked with <h2> . <h3> headings sits under <h2> in rank and importance. You don't have to follow this <h1> <h2> <h3> pattern but it's good practice if you do.
<nav> is used to mark sections where navigation is located such as menus, table of contents, and indexes. Nested inside is usually a series of links that directs the user to other parts of the document or to a different document.
The <main> tags is often used to mark the difference between a navigational section from the main content of the document.
A <section> is used to represent a standalone portion of the document. For example, in a webpage, you might separate your content into sidebar sections and main content.
The <header> area usually contains things like the logo, search form, and navigation. Just think of the top most section of a webpage.
The <footer> is often located at the end of the document. It can contain a number of things such as copyright information,
<article> is a self-contained section inside a document that's intended to be reusable or redistributed in some form such as RSS feeds. For example, you can a blog that automatically loads a new post when you reach a certain point in the page. The <article> tags and its contents inside is contained and differentiated from the <article> tags before it. Think of it as a container for content.
An aside is part of the webpage but more supplementary than being the actual main content. For example, endnotes, comments and additional elements located inside <article> or <section> like adverts.
Used for marking addresses/contact information.
p stands for paragraph and is used to wrap around text.
ul is an abbreviation of unordered list and renders as bullet points.
ol represents ordered list and will show a numbered list.
li is used to mark the individual list items inside your ul or ol list.
A blockquote is used to enclose text that is a quote from somewhere. When you use it with <cite>, you can add the source attribution such as author name or url link.
A div is a generic container that's used for content flow. It's one of the most popular element that gets styled by CSS.
A pre is a preformatted text that gets rendered exactly as it is being displayed. It's often used by tech based blogs to style code-based text that sits inline with the rest of the content.
Inline Text Semantics
An <a> tag - or anchor tag - is used for links within the page or to a different document via a url. This is done through an href attribute and looks something like this: <a href="somelink.com">Click me!</a>
Officially, b is called the Bring Attention To element -- but the easier way to remember is that it stands for bold and is used to create a visual contrast for text in various spaces such as paragraphs.
A br acts as a line breaker. This is different from the <p> tag because it's like pressing enter in a text document but without it being a completely different paragraph. It comes in useful for things like breaking up addresses and poems onto different lines while keeping it wrapped together as a unit.
cite is often used with <blockquote> and is used to describe the origin or reference to whatever is inside the blockquote.
<code> is used to display content that needs to be displayed as indicated and is a fragment of computer code. This is mostly used in spaces like technical blog posts.
em stands for emphasis and is often styled in italics, bold, or a mixture of both to help stress the importance of the marked text.
i stands for idiomatic text and is used to mark text that is idiomatic, technical, taxonomical, etc. A lot of people often use it incorrectly as an italics marker. If you want to make your text italics for emphasis, it's better to use <em>.
mark is used to represent text that is marked or highlighted for referencing or notation purposes.
<q> is similar to <blockquote>, except <q> is inline and often enclosed a pair of quotation marks when displayed on the page.
s stands for strikethrough and will display the surrounded text with a strikethrough.
small is often used for side comments and small print. Visually, it is represented by making the font smaller than the usual surrounding text.
strong stands for strong importance and is similar to <b> in visual appearance. However, <strong> marks the content as having greater importance than <b>.
sub is used for inline text that needs to be displayed in a subscript manner. For example: x2
sup is used for inline text that needs to be displayed in a superscript manner. For example: x2
time is used to mark a specific period of time.
Image and Multimedia
img is a self closing tag that is used to display images. It is self closing because there is no content required in between the <img> tag and HTML requires all tags to be closed off with /. The image source is used to fetch the image you want and display it as-is before it gets styled by CSS.
map is used in conjunction with <area> to define contain the different clickable areas within a particular image.
area is used to to create predefined clickable areas inside map. These are often geometric shapes on a target that can be used to link to other web pages.
audio is for embed sound based content into the document. The src attribute is used to signify the source of the audio content.
video is used to embed video content onto a page.
embed deals with external content that gets pulled into the page and is provided by a third party. This can be things such as Twitter feeds, YouTube videos, and Instagram rolls.
an iframe acts as a browser page within the page. It embeds another HTML page within the actual HTML page.
picture is similar to <img> tags, except it lets you list out multiple sources based on context. This is done through <source> tags. For example, you might want a small image to load if the screen size is smaller than 650px. <img> is used as the final fallback if none of the <source> tags qualifies.
A <source> tag is used with <picture> and can specify different types of media resources such as pictures, audio, and video.
SVG and MathML
svg stands for Scalable vector Graphics. Using <svg> in your HTML document will let you draw vector images through a series of coordinates and attributes.
caption sets the title of the table
col defines a column within a table
colgroup groups the columns within a table
table is the wrapper container for the table you're trying to create
tbody stands for table body. It covers the set of rows that isn't the heading.
td stands for table data and defines the single cell inside the table.
tfoot is the table footer which is often the final set of rows that is used to summarize the various columns.
th are the individual cells that sits inside the table header <thead>
thead is the table header and is usually the first line that's used to define the various heading titles for each column.
tr stands for table row and defines a new row.
Here is an example of what an HTML table can look like (with a little bit of inline CSS styling so it doesn't look so squished):
A form element acts as a wrapping container for your entire form and keeps all the various fields together as a group.
A label is used to create a text caption for the associate input or form item field.
An input is a field that you can type in. An input can have attributes attached to it to tell the browser what kind of input field it is, such as text, password, email and number.
textarea creates a multi-line plain text box that you can type in. It's often used for comments or part of the feedback form.
A button is exactly as it describes -- a button. You can click it, disable it, attach events to it, and style it based on its state.
A legend is the caption for the content of its parent fieldset.
A fieldset is used to group several elements and labels together.
A datalist is a set of <option> elements that you can chose from.
optgroup lets you group options within a select element.
select lets you set a menu of options.
A meter looks a bit like a progress bar that lets you define a range based on max and min attributes or value of a percentage via decimal.
A progress element is usually used to show the completion of something and is often displayed as a progress bar.
It's nice to have all these HTML form elements, but what does it actually look like? Here are some simple code samples and patterns for you to reference when it comes to writing your own HTML code.
Take note that the assigned value inside the for attribute at <label> links it to the associated form element id. This means that for things like checkboxes and radio buttons, you can click on the label and it will still work.