CSS – List Of CSS Properties

In this chapter I will give you a partially complete list of CSS properties.

My aim is to have a maximum amount of CSS properties on this page. We have already seen a lot of them in the lessons, but there are also properties that we haven’t had the time to see in the tutorials. Most of them are quite rare but easy to use.

The list is only partial because I don’t want to make a complete list of CSS properties that exist. There are too many, and a lot of them are never used.
Therefore, I prefer to concentrate on the main ones, and as you’ll see, there are still a lot of them icon wink CSS   List Of CSS Properties

Properties For Text Formatting

In this part I’ll put most of the properties used for text formatting.

What is text formatting ? It’s everything that has to do with the shape and size of the text : bold, italic, underlined, font, alignment etc…

Font, Size & Decoration

Type Property Possible Values
Name of the font font-family

Indicate the names of the fonts in the order you want them :

Code : CSS

font-family: font1, font2, font3;

If the visitor has font1 on his computer, font1 will be used. If not, the computer will try font2 then font3 etc.
Use speech marks if the name of a font has spaces in it. Always put the last font as serif or sans-serif.

Code : CSS

font-family: "Arial Black", Arial, Verdana, serif;
Size of the text font-size

Indicates the size of the text.
Several measurements are possible :

  • px (pixels)
  • % (percentage, 100% = normal)
  • em (related size, 1.0 = normal)
  • ex (related size from the height of the letter x. 1.0 = normal)
  • name of the size :
    • xx-small
    • x-small
    • small
    • medium
    • large
    • x-large
    • xx-large
Bold font-weight
  • bold
  • bolder
  • lighter
  • normal (by default)
Italic font-style
  • italic
  • oblique
  • normal (by default)
Decoration text-decoration
  • underline
  • overline
  • line-through
  • blink
  • none (by default)
Small capitals font-variant
  • small-caps
  • normal (by default)
Capitals text-transform
  • uppercase
  • lowercase
  • capitalize
  • none (by default)
Mega Property font

Indicate in the order you wish the values for font-weight, font-style, font-size, font-variant, font-family.
Be careful, exception : the name of the font (font-family), must be last in the list.
You don’t have to put values for every attribute.

Example :

Code : CSS

font: bold, 16px, Arial;

Alignment

Type Property Possible Values
Horizontal alignment text-align
  • left (by default)
  • center
  • right
  • justify
Vertical alignment vertical-align

Can be used in the cells of a table or in inline elements that are contained inside inline elements :

  • top
  • middle
  • bottom
Distance between lines line-height Indicate a value in pixels (px) or a percentage (%)
Indentation text-indent

Indicate a value in pixels for the indentation.
Your paragraphs will start with the indentation you’ve entered.

Line break white-space
  • normal (by default)
  • nowrap : no automatic line break unless a <br /> tag is present.
  • pre : line break are like the source code is presented (like the XHTML tag <pre>)

Background Colour Properties

Type Property Possible Values
Text colour color

Indicates the colour with one of the following methods :

  • by writing the name in English (black, blue, green, white, red…)
  • with a hexadecimal value (#CC48A1)
  • with a color in RGB : rgb(128, 255, 0)
Background colour background-color Works the same as color.

Background Image

Type Property Possible Values
Background image background-image

Indicate the URL of the image (absolute or related URL) :

background-image: url("images/bg.png");  /* related address */
background-image: url("http://www.mysite.com/images/bg.png");  /* absolute address */
Fixed background background-attachment
  • fixed
  • scroll
Repeat the background background-repeat
  • repeat : the background repeats all over (by default)
  • repeat-x : the background only repeats horizontally
  • repeat-y : the background only repeats vertically
  • no-repeat : the background doesn’t repeat, it’s only shown once
Position of the background background-position

There are 2 different methods :

  • enter a distance in pixels (px) or a percentage (%), in relation to the top-right corner :

    Code : CSS

    background-position: 50px 200px;  /*50px to the right and 200px down */
    
  • use a predefined value, one for the vertical and one for the horizontal position :

    • top
    • center
    • bottom
    • left
    • center
    • right

    Code : CSS

    background-position: bottom right;
    
Mega background property background

Indicate one or several values from background-image, background-repeat, background-attachment, background-position.
The order of the values doesn’t matter and you don’t have to include values for every property (1 is enough).

Code : CSS

/* the background bg.png will be shown in the top right and won't be repeated */
background: url("images/bg.png") no-repeat fixed top right;

Box Properties

Dimensions

Type Property Possible Values
Width width Value in px, % or auto (by default, depends on the text or content inside)
Height height Works like width
Set minimum width min-width Indicate a value in pixels for example.
Set maximum width max-width Same
Set minimum height min-height Same
Set maximum height max-height Same

Outside Margins

Type Property Possible Values
Top margin margin-top Indicate a value like 20px, 1.5em…
Left margin margin-left Same
Right margin margin-right Same
Bottom margin margin-bottom Same
Margin mega property margin

Indicate between 1 and 4 values. Depending on the number of values the meaning changes :

  • 1 value : margin for the top, bottom, left and right
  • 2 values : the first is for the top and bottom margins, the second is for the left and right margins
  • 3 values : the first is the top margin, the second is the left and right margins, the third is the bottom margin
  • 4 values : in the order of the top, right, bottom and left margins

Inside Margins

Type Property Possible Values
Top padding padding-top Indicate a value like 20px, 1.5em…
Left padding padding-left Same
Right padding padding-right Same
Bottom padding padding-bottom Same
Padding mega property padding

Indicate between 1 and 4 values. Depending on the number of values the meaning changes :

  • 1 value : padding for the top, bottom, left and right
  • 2 values : the first is for the top and bottom margins, the second is for the left and right margins
  • 3 values : the first is the top margin, the second is the left and right margins, the third is the bottom margin
  • 4 values : in the order of the top, right, bottom and left margins

Borders

Type Property Possible Values
Width of the border border-width Indicate a value in pixels (px)
Colour of the border border-color Indicate a colour in English, hexadecimal or RGB
Type of border border-style
  • none (by default)
  • hidden : invisible border
  • solid : solid line
  • double : two parallel lines (needs a minimum border of 3px)
  • dashed
  • dotted
  • inset : 3D effect going away
  • outset : 3D effect coming out
  • ridge : another 3D effect
Left border border-left

Indicate the colour, thickness and type of border for the left border.
The order doesn’t matter. Example :

Code : CSS

border-left: 2px inset blue;
Top border border-top Same
Right border border-right Same
Bottom border border-bottom Same
Border mega property border Indicate the colour, thickness and type of border for every side.

Properties For Positioning & Displaying

Displaying

Type Property Possible Values
Type of element display
  • none : the element won’t be shown
  • block : the element becomes a block (like <p>)
  • inline : the element will become inline (like <br />)
  • list-item : the element will become part of a list (like <li>)
Change the visibility visibility
  • hidden
  • visible (by default)
  • none : makes the element go away completely whereas hidden hides the element but the element still takes up room on the screen.
Only show part of an element clip

Indicate 4 values like this :

Code : CSS

clip: rect(value1, value2, value3, value4);

Allows us to only show a part of an element. rect() allows us to insert the coordinates of the rectangle that will be shown.
Values 1 to 4 correspond respectively to the top, right, bottom and left corners of the rectangle.

Limit visibility overflow
  • visible : everything will be shown (by default)
  • hidden : the element will be cut off if it goes past the dimensions set by width and height. You won’t be able to see the text that has been cut off.
  • scroll : like with hidden, the element will be cut off. However, this time a scroll bar will be added to allow us to see the rest of the text.
  • auto : this time the browser decides if a scroll bar needs adding or not. Very often this is just like using scroll.

Positioning

Type Property Possible Values
Floating float
  • left : float to the left
  • right : float to the right
  • none (by default)
Stop floating clear
  • left : stops left float
  • right : stops right float
  • both : stop left and right floats
  • none : doesn’t stop any float
Type of positioning position
  • absolute : absolute positioning in relation to the top left corner
  • fixed : fixed position (works like absolute). The element always stays in the same position on the screen, even when you scroll.
  • relative : position in relation to the normal position of the element
  • static : normal position (by default)
Position in relation to the top top Value in px, em, %… To be used for absolute, fixed or related positioning.
Position in relation to the bottom bottom Same
Position in relation to the left left Same
Position in relation to the right right Same
Order of display z-index

In the case of absolute positioning for example, if 2 elements overlap, z-index allows us to say which element should be shown on top.
Put a num. The higher the number is, the more the element will be brought forward.

For example, if 2 elements are using absolute positioning and they overlap with a z-index of 10 for one, and z-index of 20 for the other, the one with 20 will be at the front.

List Properties

Type Property Possible Values
List style list-style-type
  • For unordered lists (<ul>) :

    • disc
    • circle
    • square
    • none
  • For ordered lists (<ol>) :

    • decimal
    • decimal-leading-zero
    • upper-roman
    • lower-roman
    • upper-alpha
    • lower-alpha
    • lower-greek
Indent list list-style-position
  • inside : without indent
  • outside : with indent (by default)
Personalised bullet point list-style-image

Indicate the URL of the image which will act as a bullet point. Example :

Code : CSS

list-style-image: url("images/point.jpg");
List mega property list-style

You can reunite the values of list-style-type, list-style-position and list-style-image. You don’t have to put values for everything and the order doesn’t matter.
Example :

Code : CSS

list-style: square inside;

Table Properties

Type Property Possible Values
Type of border border-collapse
  • collapse : the borders of the table and cells are merged
  • separate : the borders are separated (by default)
Display empty cells empty-cells
  • show : empty cells are visible
  • collapse : empty cells are hidden (by default)
Position of the title caption-side

Indicate the position of the table’s title, defined with the <caption> tag :

  • top : top of the table
  • bottom : bottom of the table
  • left : to the left of the table
  • right : to the right of the table

Other Properties

Type Property Possible Values
Mouse cursor shape cursor
  • auto
  • default
  • pointer
  • text
  • wait
  • progress
  • help
  • move
  • n-resize
  • ne-resize
  • e-resize
  • se-resize
  • sw-resize
  • w-resize
  • nw-resize
  • url : personalised cursor, in .cur or .ani format. Example :

    Code : CSS

    cursor: url("images/cursor.cur");
    

    You must use a special program to create .ani or .cur cursors.

Leave a Reply