Show Menu
Cheatography

Format

Your CSS code is written in rule sets like below:
h1 {color­:blue;}

In this example color is the property 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:
.class­-name {}

#id-name{}

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
   
 

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

            HTML Hex CSS & Octal character entities Cheat Sheet by Robin Thomas and Estelle Weyl
          Five ways to center DIV element in CSS Cheat Sheet

          More Cheat Sheets by bobsaget7