css 101

Available Properties

So far we've been using a small handful of properties in our examples (color, background-color, border, etc.). But obviously there are many more attributes available. So... what exactly can you stick in a name:value pair? Think back to the HTML 101 tutorial, where we said that different HTML elements could take different attributes. The situation is very much the same here -- it makes sense to specify the color of a font, but not of an image. For the most part, though, you can attach almost any attribute to almost any element on a page. Again, see a complete CSS reference such as the one hosted by W3Schools for detailed listings. In this section we'll cover some of the most commonly used attributes and some of their allowable values. This list is by no means complete.

A quick note on comments. If you want to leave a note to your future self or for another developer on your team in your CSS code, just surround any amount of text with /* and */. It's good practice to comment code in any programming language when its purpose is not immediately obvious.

The CSS rabbit hole goes very deep, but this is a CSS 101 tutorial, not a comprehensive manual. We cover the most commonly used attributes and their possible values, with implementation notes below.