Lesson 8: CSS Attributes

So just what can you style using CSS? Here are some common ones. I won’t go into the details of where you can validly use them — you can find that here.

background
Lets you set the background. It can take a colour, or an image (in the form url(path/to/your/img))
border
Sets the border around an element. It’s least confusing to set the individual properties separately (border-top, border-left, border-right, border-bottom). You can set a colour, width, and style (dotted, dashed, solid, double, groove, ridge, inset, outset)
font
Sets the font. You can specify the font name, size, style (normal, italic, oblique), and weight (normal, bold, bolder, lighter).
margin
Sets aside some space outside the border. It’s least confusing to set margin-top, margin-left, margin-right and margin-bottom separately.
padding
Sets aside some space inside the border, before the actual content. It’s least confusing to set padding-top, padding-left, padding-right and padding-bottom separately.
text-align
left, right, center or justify.
text-decoration
none, underline, overline, line-through, and blink (ugh!).
text-indent
Indents the first line of text.

Colours

CSS allows you to name certain colours like black, white, red, green, etc. It also allows you to specify any colour in the rainbow. Here’s some more information.

Previous Lesson Index Next Lesson