CSS Cheat Sheet

A Programming › CSS cheat sheet in English by bobsaget7
16,564 views 3,360 downloads 28 Feb 2017 History
3.7 avg · 0 ratings

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

Badges

Nice Cheat Sheet Good Cheat Sheet

Comments

No comments yet.

Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.