Show Menu
Cheatography

CSS Cheat Sheet (DRAFT) by

CSS

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

CSS IN HTML

Descri­ption
Syntax
Define external css file inside <he­ad>
<link rel="st­yle­she­et" type="t­ext­/cs­s" href="f­ile­nam­e.c­ss"
Define class for HTML tag
<p class=­"­cla­ssn­ame­"­>Te­xt<­/p>
Define id for HTML tag
<p id="­idn­ame­"­>Te­xt<­/p>

General

Property
Values
tag
tag
class
.nameo­fclass
id
#nameofid

FONT

Property
Values
font-style
italic, normal...
font-w­eight
bold, normal...
font-size
For example 12px
font-f­amily
"­Times New Roman", "­Comic Sans MS"...

TEXT

Property
Values
color
color name or RGB code of the color
text-align
left, center, right
text-d­eco­ration
none,o­ver­lin­e,u­nde­rli­ne...
text-t­ran­sform
capita­lize, lowercase, uppercase

Box Model

Property
Values
height
Height in px
width
Width in px
margin­-top, margin­-right, margin­-left, margin­-bottom
Margin in px
paddin­g-top, paddin­g-r­ight, paddin­g-left, paddin­g-b­ottom
Padding in px

Background

Property
Values
backgr­oun­d-color
color name or RGB code of the color
background image
image.jpg

Links (in the same order as below)

a:link
a:visited
a:hover
a:active