HTML Cheat Sheet is used to develop web pages and HTML latest version 5.x has different features and functionalities in its HTML Elements and Form tags. The other different features are HTML local and session storages in the browser. The element defines a section in a document. According to W3C's HTML documentation: 'A section is a thematic grouping of content, typically with a heading.' A web page could normally be split into sections for introduction, content, and contact information.
This is a cheat sheet with all of the common HTML5 tags, attributes, semantic markup, etc.
All tags can have attributes which are placed within the start tag providing information about an element.
<tagname attribute = 'value'>content</tagname>
The HTML element is everything from the start tag to the end tag.HTML elements with no content are called empty elements. Empty elements do not have an end tag, such as the <br> element (which indicates a line break).
Inline vs Block Level Elements
Inline Level: <span>, <img>, <a>, <strong>, <em>
- Do not start on a new line
- Take only the necessary width
Block Level: <div>, <header>, <h1>-<h6>, <p>, <form>, <ol>, <ul>
- Start on a new line
- Take up the full width available
The <span> element is often used as a container for some text. The <span> element has no required attributes, but style, class and id are common.
<div>
The <div> element is often used as a container for other HTML elements. The <div> element has no required attributes, but style, class and id are common.
Text Formating
Html Semantic Tags Cheat Sheet Printable
Formatting elements were designed to display special types of text:
<b>- Bold text<strong>- Important text<i>- Italic text<em>- Emphasized text<mark>- Marked text<small>- Small text<del>- Deleted text<ins>- Inserted text<sub>- Subscript text<sup>- Superscript text
Link
HTML links are defined with the <a> tag. The link address is specified in the href attribute:

List
HTML lists are defined with the <ul> (unordered/bullet list) or the <ol> (ordered/numbered list) tag, followed by <li> tags (list items):
Table
Form
The HTML <form> element defines a form that is used to collect user input. An HTML form contains form elements:
Input Types
Form elements are different types of input elements, like text fields, checkboxes, radio buttons, submit buttons, and more.
The <input> element is the most important form element. The <input> element can be displayed in several ways, depending on the type attribute:
<input type='text'><input type='password'><input type='submit'><input type='button'><input type='checkbox'><input type='color'><input type='date'><input type='datetime-local'><input type='email'><input type='file'><input type='hidden'><input type='image'><input type='month'><input type='number'><input type='radio'><input type='range'><input type='reset'><input type='search'><input type='tel'><input type='time'><input type='url'><input type='week'>
Input Attributes
The value attribute specifies the initial value for an input field. The maxlength attribute specifies the maximum allowed length for the input field. The min and max attributes specify the minimum and maximum values for an <input> element. The placeholder attribute specifies a hint that describes the expected value of an input field (a sample value or a short description of the format).
Semantic Html Cheat Sheet
The action attribute defines the action to be performed when the form is submitted. The method attribute specifies the HTTP method (GET or POST) to be used when submitting the form data. Each input field must have a name attribute to be submitted. If the name attribute is omitted, the data of that input field will not be sent at all.
Button
HTML buttons are defined with the <button> tag:
Image
HTML images are defined with the <img> tag.
Quotation
Attributes are used to provide additional information about HTML elements. Attributes are always specified in the start tag as name=”value”.
style
<tagname>
The property is a CSS property. The value is a CSS value.
Some of the properties are background-color, color, font-family, font-size, text-align.
class
The class attribute is used to define equal styles for elements with the same class name.
Html Semantic Tags List
So, all HTML elements with the same class attribute will get the same style.
JavaScript can access elements with a specified class name by using the getElementsByClassName() method.
id
The id attribute specifies a unique id for an HTML element (the value must be unique within the HTML document).
In CSS, to select an element with a specific id, write a hash (#) character, followed by the id of the element.
JavaScript can access an element with a specified id by using the getElementById() method.
Semantic Tags
A semantic element clearly describes its meaning to both the browser and the developer.
Document
<title>Second most important piece of content.
Shown in the browser tab & search results.
Should be unique for every page on the site.
For linking CSS and other resources like feeds.
hrefis the path the file.relhas different values for other resources.
<header>When inside
<body>it’s the website masthead.When inside
<article>it’s the most important information.
When inside
<body>it’s the website footer.When inside
<article>it’s the least important information.
<main>Primary content of the page.
Defines a group a navigation links.
<article>A piece of content that’s independent.
Could be removed from this website and still make sense.
A group in a series of related content pieces.
<aside>Secondary content not required to understand the main content.
Navigation inside header
Lists
<ul>An unordered list—the order of items isn’t important.
Can only have
<li>elements as direct children.
An ordered list—the order of the items is important.
Could be alphabetical, numerical, best to worst, etc.
Can only have
<li>elements as direct children.
<li>A single list item.
Must be inside a
<ul>,<ol>or<menu>.Can have most other elements inside it.
A description list—a grouping of terms and definitions.
Words & definitions, titles & summaries, data points, etc.
Can only have
<dt>and<dd>elements as direct children.
<dt>Description title, the term of the item.
Must come before the
<dd>.
Description definition, the data, or text of the item.
Can be multiple
<dd>tags underneath one<dt>.
Unordered list
Description list
For semantically marking up a web application’s toolbar of buttons.
The
<menu>tag also uses<li>tags inside—one for each toolbar button.You may still have to remove the bullets.
Menu toolbar list
Text
For making hyperlinks.
hrefis the path to where the link should go.
<h1>The most important piece of content on the page.
On the homepage this should be the company’s name.
On inside pages this should be the page title.
Content headings, each a sub-heading of the one above.
The
<h2>is a sub-heading of<h1>,<h3>a sub-heading of<h2>, etc.
<hgroup>Allows you to group multiple headings together and have them semantically treated as a single heading.
It’s primary purpose is for subheadings.
A generic paragraph of text.
<blockquote>A large, stand alone quote from another source.
A citation for another source, often used with quotations.
A person’s name, a URL, a book, a movie title, etc.
<q>A small quotation embedded within other content.
A string of emphasized, slightly more important text.
Screen readers will change their voice for this text.
<strong>A string of highly emphasized, much more important text.
Screen readers will change their voice for this text.
Content that was inserted after the document was published.
datetimedefines when it was added.
<del datetime='…'>Content that was deleted after the document was published.
datetimedefines when it was removed.
An acronym or abbreviation, like “HTML”, “CSS”, etc.
titlecontains the expanded version, like “Hypertext Markup Language”.
<dfn>A definition of a term on the page.
Should only be used once of the term.
Used to highlight a piece of text for reference.
The keywords in a search results page, the current navigation item.
<i>Defines technical term, a ship name, a book title, a thought, sarcasm, another language.
Defines a keyword, like product name in a review, a lead sentence in a paragraph.
<s>Content that’s no longer relevant to the document.
Consider if the
<del>element is better suited first.
Labels the text as having a non-textual annotation.
A misspelled word, a Chinese proper name, etc.
<small>Represents side comments and fine print.
Contact information, email, tel, postal address, etc.
Blockquotes
Text edits
Abbreviations
Images & media
<img src='…' alt='…'>Embeds an image that’s important to the content.
srcis a path to the image file.altdescribes the image if it cannot be seen.
Embeds annotated images, illustrations, photos, code, etc.
Could be moved out of place and would still make sense.
<figcaption>For adding a caption/annotation to the
<figure>.Must be inside a
<figure>element—cannot stand alone.
Responsive image insertion—allows developers to provide different images for different contexts.
<video poster='…' autoplay loop muted controls>For embedding movies into a website.
posteris the path to an image that’s displayed before the video plays.autoplaywill hint the video to start automatically.looptriggers whether the video should repeat or not.mutedcan be added to not play sound by default.controlsshows or hides the browser’s player buttons.
For embedding sounds into a website.
autoplaywill hint the audio to start automatically.looptriggers whether the audio should repeat or not.mutedcan be added to not play sound by default.controlsshows or hides the browser’s player buttons.
<source>Must be inside
<picture>,<video>or<audio>to define the different versions of content.For example, in video it gives paths to the MP4 and WEBM formats.
Used to pair captions, chapters, etc. with
<video>elements.
Figures & captions
Use only if there’s a caption.
See Responsive & retina images for details.
Data & code
<sub>Defines text as being subscript.
Defines text as being superscript.
<var>Represents a variable in math or programming.
Marks some text as a time or date.
datetimedefines the machine readable version.
<data value='…'>Marks elements as being a numerical piece of information.
valueprovides the machine readable version.
Represents a single number in a range of numbers.
valueis the current number.minis the minimum number.maxis the maximum number.
<progress value='…' min='…' max='…'>Represents the current position in a series of steps.
valueis the current position.minis the minimum position.maxis the maximum position.
Defines a piece of text as a code sample.
<pre>A piece of text that has a specific formatting, where tabs, whitespaces, etc. should be maintained.
Something a user should type into their computer.
<samp>Something a user should see output from a computer.
Time
Maths
Meaningless tags
Inherits meaning from its children.
Divides content into logical groups, when no other tag is better suited.
Has restrictions on what elements it can be inside.
<span>Inherits meaning from its children.
Be careful
Creates a line break that’s significant to the content.
Useful in poems and addresses where the division of lines is important.
Do not use to create space in a design—use margins and padding.
<hr>Represents a thematic break in the content.
For example, a scene change or topic change.
Do not use to create a horizontal line—use CSS borders.
Represents a interactive, clickable button.
Should be used in forms and with JavaScript.
Do not use to link to another page—use the
<a>tag.
<wbr>Presents an opportunity for the browser to add a line-break if necessary.
Groups strings of text, when no other tag is better suited.
Links
The
hrefalways needs a value—#means nowhere.
Links on the same page
Add an
id='to the element to jump to, refer to that inside thehref
Just write the name of the HTML file, also include any folders its inside.
Links to other websites
Always start with
https://or less ideallyhttp://
Start with
tel:, use international formatAlso send a text message with
sms:
Links to email addresses
Pops open a new email message, start with
mailto:%20is used to escape spaces—See more percent-encoding examples
Date/time formats
Html Semantic Tags Cheat Sheet Pdf
Apply to the datetime=' attribute of the <time>, <del> & <ins> elements.
Html Semantic Tags Cheat Sheet Template
Format:
YYYYExample:
1963
Year, month
Format:
YYYY-MMExample:
1963-11Nov. 1963
Format:
YYYY-MM-DDExample:
1963-11-23Nov. 23, 1963
Year, week
Format:
YYYY-WddExample:
1963-W471936, the week of Nov. 18–24
Format:
HH:MMExample:
17:165:16 PM
Hour, minute, second
Format:
HH:MM:SSExample:
17:16:205:16:20 PM
Format:
HH:MM:SS.sssExample:
17:16:20.2585:16:20.258 PM
UTC timezone
Format:
ZExample:
ZUTC timezone
Format:
±HH:MMExample:
-05:00Eastern Standard Time, Daylight Savings
Year, month, day, hour, minute
Format:
YYYY-MM-DDTHH:MMExample:
1963-11-23T17:16Nov. 23, 1963 at 5:16 PM
Format:
YYYY-MM-DDTHH:MM:SSExample:
1963-11-23T17:16:20Nov. 23, 1963 at 5:16:20 PM
Year, month, day, hour, minute, second, millisecond
Format:
YYYY-MM-DDTHH:MM:SS.sssExample:
1963-11-23T17:16:20.258Nov. 23, 1963 at 5:16:20.258 PM
Format:
YYYY-MM-DDTHH:MMZExample:
1963-11-23T17:16ZNov. 23, 1963 at 5:16 PM UTC
Year, month, day, hour, minute, timezone
Format:
YYYY-MM-DDTHH:MM±HH:MMExample:
1963-11-23T12:16-05:00Nov. 23, 1963 at 12:16 AM EST
Format:
YYYY-MM-DDTHH:MM:SS±HH:MMExample:
1963-11-23T12:16:20-05:00Nov. 23, 1963 at 12:16:20 AM EST
Year, month, day, hour, minute, second, millisecond, timezone
Format:
YYYY-MM-DDTHH:MM:SS.sss±HH:MMExample:
1963-11-23T12:16:20.258-05:00Nov. 23, 1963 at 12:16:20.258 AM EST
Format:
PddDExample:
P686D686 days
Period of days, hours
Format:
PddDThhHExample:
P686DT23H686 days, 23 hours
Format:
PddDThhHmmMExample:
P686DT23H18M686 days, 23 hours, 18 minutes
Period of days, hours, minutes, seconds
Format:
PddDThhHmmMssSExample:
P686DT23H18M14S686 days, 23 hours, 18 minutes, 14 seconds
Period of days, hours, minutes, seconds, milliseconds
Format:
PddDThhHmmMss.sssSExample:
P686DT23H18M14.400S686 days, 23 hours, 18 minutes, 14 seconds, 400 milliseconds
Format:
PThhHExample:
PT23H23 hours
Period of minutes
Format:
PTmmMExample:
PT18M18 minutes
Format:
PTmmMssSExample:
PT18M14S18 minutes, 14 seconds
Exact date example
Range of time periods




