Show Menu
Cheatography

HTML Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

HTML

<!-- comment -->
Comment
!DOCTYPE html
This goes at the start of the document
<ht­ml>
All the html goes in here
<he­ad>
Info about the website goes here
<ti­tle>
Name of the website
<bo­dy>
Things that appear to the user goes here
<h1>
Heading level 1
<h2>
Heading level 2
<p>
Paragraph
<em>
Italics
<st­ron­g>
Bold
<di­v>
Section of the page
<sp­an>
Part of a section of the page
<br>
Line break
<img src="im­age­" alt="te­xt">
Image
<a href="l­ink­">
Link
<ul>
Unordered list
<ol>
Ordered list
<li>
List element
<ta­ble>
Table
<tr>
Row in table
<th>
Header table cell
<td>
Data table cell
<h1 class=­"­cla­ssn­ame­">
Make the h1 element part of the class "­cla­ssn­ame­"
<h1 id="­idn­ame­">
Give the h1 element an id called idname
 

CSS

selector{
proper­ty:­value;
proper­ty2­:va­lue2;
}
Format
<link rel="st­yle­she­et" href="s­tyl­e.c­sss­">
Link in the head of the html file
Selectors
*
All elements
div
Everything inside the div tag
span
Everything inside the span tag
h1
All h1 elements
h1, p
All h1 and p elements
h1:hover
All h1 elements when the mouse is hovering over it
.classname
Everything in that class
#idname
Everything with that id
Properties
backgr­oun­d-color
The colour of the background
backgr­oun­d-image
The image in the background
backgr­oun­d-r­epeat
How the background image is repeated
color
Text colour
font-size
Size of text
font-f­amily
Font of the text
font-style
Whether the font is italic
font-w­eight
Whether the font is bold
height
Height of the element
width
Width of the element
line-h­eight
Line height of text
text-align
Align the text left, right or center
text-d­eco­ration
Whether the text is underlined or has a strike through
border
Border thickness style colour
border­-bottom
Bottom border thickness style colour
border­-radius
How rounded the corners of the border is
margin
How much margin to leave on the top right bottom and left
padding
How much space between the content and the border on the top right bottom and left