AgerNic.com
WEB DEVELOPER SITE, HTML, CSS, PHP, SQL
HTML Tutorial

CSS Margin, top, bottom, left, right

The margin attribute sets "as the name says" a distance beyond the previously set boundary. The defined edge will not have any color, in other words it will be transparent. The CSS margin properties are used to create space around boundary, outside of any defined borders.

Margin - Individual Sides as top, right, bottom, left

With CSS, you have full control over the margins and you can add any value. There are properties for setting the margin for each side of an element (margin-top, margin-right, margin-bottom, and margin-left).

All the margin properties can have the next value:
Note: Negative value for margin are not allowed for CSS margin-top, margin-right, margin-bottom, margin-left

If the margin property has this four value:
margin: 12px 15px 12px 16px;
top margin is 12px
right margin is 15px
bottom margin is 12px
left margin is 16px

Example:
div-box1 { margin: 12px 15px 12px 16px; }

CSS margin - Shorthand Property

To shorten the code, it is possible to specify all the margin properties in one property.
The css margin property is a shorthand property for the following individual margin properties:
margin-top is 12px
margin-right is 15px
margin-bottom 12px
margin-left 16px

Example:
div-box1 { margin: 12px 15px 12px 16px; }
If the margin property has three values:
margin: 12px 15px 14px;
top margin is 12px
right and left margins are 15px
bottom margin is 14px

Example:
div-box2 { margin: 12px 15px 14px; }
If the margin property has two values:
margin: 15px 20px;
top and bottom margin are 15px
right and left margin are 20px

Example:
div-box3 { margin: 15px 20px; }
If the margin property has one value:
margin: 16px;
all four margins are 16px

Example:
div-box4 { margin: 12px; }

CSS Margin auto alue

You can set the margin property to auto to horizontally center the element within its container.

Example:
div-box5 {
width: 320px;
margin: auto;
border: 1px solid blue;
}


CSS margin top, margin bottom, margin left, margin right, css margin 0 auto
CSS Margin, top, bottom, left, righ, auto - css tutorial

Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


HTML Templates
news templates
Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.


CSS Scrollbar Horizontal
CSS Scrollbar in Div
CSS Scrollbar Firefox
CSS Style Scrollbar
CSS Style Text
CSS background color
CSS Div Id Class
CSS Text Wrap
CSS text-align
CSS Text Decoration
CSS Text Shadow
CSS Text Color
CSS Text Bold
CSS Text Size
CSS background image full
CSS background opacity
CSS border radius
CSS rounded corners
CSS font color
CSS Class & ID
CSS align image center
CSS align content
CSS link color
CSS Text Style
CSS Text Font Size
CSS max width &height
CSS width and height
CSS Margin
CSS Padding
CSS Border Style
CSS background
CSS in HTML
Basic Syntax of CSS
CSS Introduction
Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


HTML Templates
news templates
Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.