HTML Cheat Sheet

html tags

Tag Name Description
<!DOCTYPE html> Document Type Declaration first line, declares that HTML is used in file
<html> HTML second line, all html sits in here
<head> Head third line, metadata of the file, not visible
<title> Title title of the page, goes in <head>
<body> Body the visible content goes here
<header> Header semantic container for nav and intro content
<nav> Navigation semantic container for listed nav links or table of contents
<main> Main semantic container for dominant content
<section> Section semantic container for a group of elements with the same theme
<article> Article semantic container for text that makes sense on its own
<footer> Footer semantic container for footer content like contact and sitemap
<aside> Aside semantic container for "additional" info
<figure> Figure semantic container for media referenced in the main content
<figcaption> Figure Caption caption for the Figure, nests within the Figure
<audio> Audio semantic container for audio media
<time> Time semantic container for time of publication
<address> Address semantic container for contact (email) address
<h1> Heading emphasize text by size, h1 (big) - h6 (small)
<p> Paragraph chunk of text
<a> Anchor clickable link, requires href attribute
<button> Button a button
<script> Script denotes the Javascript in the HTML
<div> Division generic content container
<br> Break line break
<ul> Unordered List bullet list
<ol> Ordered List numbered list
<li> List Item the stuff that goes on a list
<img> Image picture, self-closing tag, requires src attribute
<video> Video video, "content" displays if video fails, requires src attribute
<!--...--> Comment Out notes within the html, won't show on page
<i> Italic italicizes text
<b> Bold bolds text
<table> Table creates a table with rows, columns, and cells
<thead> Table Head defines the first row of a table for column titles
<tbody> Table Body table content under <thead>
<tfoot> Table Foot table content under <tbody>
<th> Table Heading defines the column title within the <thead>
<tr> Table Row defines a new row within a table
<td> Table Data defines a cell within a row
<span> Span generic tag for adding attributes like class and id

html attributes

Attribute Name Description
href Hyperlink Reference specifies linked resource location
rel Relationship defines the relationship of the doc to linked resource
src Source specifies embedded resource
alt Alternative Text describes the content should the content not load
width Width defines the width of the media
height Height defines the height of the media
controls Controls adds media player controls to videos
target Target tells a link how to open, "_blank" will open new window/tab
id ID notes a specific thing on page, non-repeatable
class Class notes to specific things on page, repeatable
colspan Column Span allows a <td> to span multiple columns, integer value
rowspan Row Span allows a <td> to span multiple rows, value = integer
lang Language defines the language of the content
hidden Hidden hides content visually and from screen readers