Search within TutorialsPark

CSS margin-left Property


To set the margin of the contents left edge


Definition and Notes.

1. The CSS margin-left property is used to set the margin of the contents left edge

2. Negative values can be used, but caution must be observed to see that the content is visible.


Syntax:

CSS margin-left property. internetexplorer safari firefox opera chrome

View in Splitscreen»

Code-Editor:

Note-If margin is specified in percent(px), the value is based on the values of the parent element.

Property Values

Value Description
length To specify the length using length units (px, pt, em , cm etc)
% To specify the length using percentages values
auto Leaves it to the browser to set the margin
inherit The value for margin is inherited from the parent element

Specifications

Specs Value
Name margin-left
Value [<length> | <percentage> | auto] | inherit
Initial Value 0
Applies to all elements except elements with table display types other than table-caption, table and inline-table.
Javascript syntax object.style.marginLeft="10px"
Inherited No
Percentages refer to the width of containing box
Computed Value For percentages, same as declared value; for length values, the absolute length
Browser Support internetexplorer safari firefox opera chrome

Related Examples.