Show Menu

CSS Cheat Sheet by

css     code

Format

Your CSS code is written in rule sets like below:
h1 {color­:bl­ue;}
In this example color is the prop­erty and blue is the value
Each line of css must end in a ;

Classes and Ids

When refere­ncing a class use a period, when refere­ncing an id use a pound sign. Example:
.clas­s-name {}
#id-n­ame{}

Spacing and Sizing

padding
The space inside the element
margin
The space outside the element
width
Can be set by pixels (px) or percen­tages (%)
height
Can be set by pixels (px) or percen­tages (%)
 

Text

color
Change your text color (use a color name or hex code)
font-size
Set the size of the text (make sure your number is followed by 'px')
text-align
Moves the placement of your text, can be center, left or right
text-d­eco­ration
Can be underline, overline, line-t­hro­ughor none

Background

backgr­oun­d-color
Set the background to any color name or hex code
backgr­oun­d-i­mage: url("li­nk")
Make the background an image, put your link in the quotes
backgr­oun­d-size
Change the size of your background image (set to "­cov­er" to fill the screen)

Borders

border­-style
Can be dotted­,da­she­d,s­oli­d,d­oub­le,­gro­ove­,ri­dge­,inset, or outset
border­-color
Change the color of your border
border­-width
How thick the line of the border is, set with px

Download the CSS Cheat Sheet

1 Page
//media.cheatography.com/storage/thumb/bobsaget7_css.750.jpg

PDF (recommended)

Alternative Downloads

Share This Cheat Sheet!

 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          CSS2 Cheat Sheet
            HTML Hex CSS & Octal character entities Cheat Sheet by Robin Thomas and Estelle Weyl

          More Cheat Sheets by bobsaget7