CSS Align Using Margin

You will often want to center align a block element (such as a div). Personally I find the best way to do this is to use CSS Align Using Margin.
Setting a margin to auto will try and force the element to the opposite side. So, if you set both left and [...]



CSS Margin

CSS Margin can be used to manipulate the space around an HTML element.
The below div have absolutely no margin on it.

No margin

If we add 10 pixels margin:

10px margin

As you can see, the CSS: .my_div { margin:10px; } adds 10 pixels of margin on ALL sides of the element. This includes the top AND bottom, [...]



CSS Box Model

The CSS Box Model is essential when learning CSS to create web page layouts. Let’s take a look at the following diagram.
The CSS Box Model is a lot simpler than how it may look at first sight. Let’s begin with the content. Think of the content area an an empty div element. [...]