CSS Properties (for CSCI 115 Midterm)
Please note that page is intended to
show the commonly-used (at least in CSCI 115) properties and values -
not a comprehensive list.
"Initial" Properties
- text-align: left | right | center
- color: red | blue | yellow | gray | . . .
- background-color: red | blue | . . .
- border: 1px solid black (for example)
Specifying Colour (for both color and background-color properties)
- color: red | blue | . . .
or color: #FF0080 (for example)
or color: #CD0 (for example - short for #CCDD00)
or color: rgb(__, __, __)
or color: hsl(hue, saturation, lightness)
Font Properties
- font-style: normal | italic
- font-weight: normal | bold
- font-size: 1.2em | 120% | 24px
- or abbreviate the above properties to (for example)
font: italic bold 1.2em Verdana, Arial, sans-serif
(The order of the first 2 values does not matter - and one or both of them can be omitted.)
- generic font families: serif, sans-serif, monospace
Text Properties
- text-align: left | right | center
Padding and Margin Examples
- padding-left: 2em
- padding: 50px
- margin: 0px 100px 0px 50px
(for top, right, bottom and left)
-
padding: 0px 200px
(for 0px top and bottom, and 200px left and right)
Border Properties and Examples
- border-style: none | solid | dotted | dashed
- border-width: 5px
- border-color: red
- border: 3px dotted blue
- border-bottom: 10px solid red
- border-top-style: dashed
- border-top-color: blue
- border-top-width: 3px
- border-width: 1px 10px 3px 10px
- border-style: dashed solid
- border-color: red blue