SITERAW

The list of CSS properties

Just as we did with HTML elements in the previous chapter, we will go over the essential CSS properties used to design website layouts.

The list of CSS properties
The list of CSS properties

This list is once again non-exhaustive and classified by property type.

Most of the CSS properties we will review have already been covered in greater depths during the course of this tutorial, so if you need more details on how a certain property is declared you can find them in the associated chapters, a direct link is provided when relevant.

Just for the sake of accuracy and thoroughness, let's start by reviewing how CSS code is applied (figure below).

CSS code syntax
CSS code syntax

The syntax of CSS code declaration is covered in greater detail in the setting up CSS chapter.

Remember that you can add as many properties as you want, for each selector, between the curly brackets.

Text formatting properties

Text formatting is everything that affects the presentation of textual content: bold, italics, underline, font, alignment, letter spacing...

Here are the main relevant properties.

PropertyDescription (Example)
font-familyFont name ( Arial )
font-sizeText size ( 15px )
font-weightBold ( bold )
font-styleItalic ( italic )
text-decorationUnderline, overline, strikethrough ( underline )
text-transformUppercase, lowercase, capitalize ( uppercase )
font-variantSmall caps ( small-caps )
@font-faceCustom font
text-alignHorizontal alignment ( center )
vertical-alignVertical alignment ( middle )
line-heightLine height ( 18px )
text-indentParagraph indentation ( 25px )
white-spaceHyphenation ( nowrap )
word-breakWord-break ( break-all )
text-shadowLetter shadow ( 5px 5px 2px blue )

You can read more about these in the text formatting chapter.

Color and background properties

The following properties are applied to manage either the color or the background of an element.

PropertyDescription (Example)
colorText color ( red )
opacityTransparency ( 0.5 )
background-colorBackground color ( red )
background-imageBackground image ( url('img.png') )
background-attachmentFixed background ( scroll )
background-repeatBackground repetition ( no-repeat )
background-positionBackground position ( center )

For more information on these properties you can refer to the color and background chapter of this tutorial.

Dimension properties

Dimension properties are all the options that involve modifying the height and width of a block-level element.

They include the dimensions of the element itself, the padding, the border and the margin.

CSS box model

The properties relevant to the CSS box model, minus those involving borders.

PropertyDescription (Example)
widthElement width ( 550px )
heightElement height ( 300px )
min-widthMinimum width ( 550px )
min-heightMinimum height ( 300px )
max-widthMaximum width ( 550px )
max-heightMaximum height ( 300px )
paddingInner padding ( 25px )
marginOuter margin ( 25px )

Border properties

These properties handle border size, shape, color and more.

PropertyDescription (Example)
border-widthBorder width ( 5px )
border-styleBorder type ( dotted )
border-colorBorder color ( red )
border-radiusRounded borders ( 5px )
box-shadowBlock shadow ( 3px 3px 0px red )

You can read more about them in the borders and shadows chapter of this tutorial.

Display properties

Lastly, these properties are used to manipulate the display and positioning of an element or an element group.

PropertyDescription (Example)
displayDisplay type ( block )
positionPositioning ( absolute )
visibilityVisibility ( hidden )
overflowOverflow ( hidden )
floatFloating ( right )
clearClear a float ( both )
topTop offset ( 20px )
leftLeft offset ( 20px )
rightRight offset ( 20px )
bottomBottom offset ( 20px )
z-indexImportance if overlap ( 10 )
cursorMouse cursor ( crosshair )

Done!

Some of you will have noticed that I didn't include every existing CSS property, as I said at the beginning... there are simply too many to list in a single chapter.

The goal of this chapter isn't to provide a complete list but rather a quick support when you need to code something in CSS.

As such, I only included the most often used CSS properties.

You can bookmark this chapter - and the previous one on HTML elements - for quick access if you ever need to verify how a property is used or what it does.