Web Development Cheatsheet

by Setto

HTML Cheatsheet

Basics

Code

Details

h1 to h6

headings

p

paragraph

a

anchor for a link

button

a button

div

division, will make it another block

span

target a content that will still make it inline

strong

bold

em

italic

br

line break

ul

unordered list

ol

ordered list

li

list item tag

img src="" alt=""

image tag, selfclosing, alt is the description of the image

video src="myVideo.mp4"
width="" height=""
controls

video tag, controls is pausing and playing buttons before video closing tag you may add text "Video not supported" and this will be displayed if the browser does not support the video.

head

above body element, the metadata

a href="https://en.wikipedia.org/"
target="_blank"

Blank and Target, For a link to open in a new window, the target attribute requires a value of _blank

a href="./contact.html"

relative page links

p id="top"
h1 id="bottom"
a href="#top"
a href="#bottom"

linking to the same page

!-- comment --

this is a comment

Attributes

Code

Details

name="value"

name value pair

width="500"

specify the width

href

hyperlink reference

onclick=".."

event listener

id

identifier may use with div to differentiate,
you may add this to h1 tags and etc

class=""

you can add this to your div code to further identify it

Tables

Code

Details

table

to create a table

th

table heading

th colspan=""

number of columns

th rowspan=""

number of rows

td

table data

thead

section off the head

tfoot

bottom part can be sectioned off

scope="col"

you can add this to your th code

scope="row"

you can add this to your th code

Semantic

nav

navigation links, can be used inside header or used on its own

main

the dominant content

footer

bottom of the subject info, contains contact info, copyright info terms of use, site map, reference links, etc.

section

a section

article

can have a p tag inside

aside

marks additional information that enhances another element good for endnotes, comments, quotes, additional info.

figure

element to describe an image, encapsulates all types of media

figcaption

content for the figure

audio autoplay controls

you may add this code inside an audio tag
source src="iAmAnAudioFile.mp3" type="audio/mp3"

embed

embed src="download.gif" /
for media files