CSS Syntax & Layout

Some More CSS Syntax…

Shorthand versus Longhand

There are various ways of specifying a given CSS property. Long hand CSS requires listing out property by property such as:

margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
margin-left: 10px;

There is the short hand version to this is:

margin: 0;

or to specify the top, right, bottom, left margin of the div.

margin: 5px 2px 5px 1px;

Note: That there isn't a wrong or right way to do this. However, be aware that for margin, padding, borders etc. the way you call it in short hand is by the top, right, bottom, left order only!

What is a Div?

A Div is a container whereas a p tag is for a paragraph of text. Any type of style can be applied to a div, essentially the div is replacing the table.

Now on to the list of particular properties…