CSS margin | CSS text margin
ExampleSettheleftmarginfora
elementto30pixels: p.ex1{ margin-left:30px;}TryitYourself»[1]More"TryitYourself"examplesbelow.DefinitionandUsageThemargin-leftpropertysetstheleftmarginofanelement.Note:Negativevaluesareallowed. Showdemo❯[2]Defaultvalue:0Inherited:noAnimatable:yes,seeindividualproperties.Readaboutanimatable[3]Tryit[4]Version:CSS1JavaScriptsyntax:object.style.marginLeft="100px"Tryit[5]BrowserSupportThenumbersinthetablespecifythefirstbrowserversionthatfullysupportstheproperty...
ExampleSet the left margin for a <p> element to 30 pixels:
p.ex1 { margin-left: 30px;}
Try it Yourself »[1]More "Try it Yourself" examples below.
Definition and UsageThe margin-left property sets the left margin of an element.
Note: Negative values are allowed.
Show demo ❯[2]
Default value: 0 Inherited: no Animatable: yes, see individual properties. Read about animatable[3] Try it[4] Version: CSS1 JavaScript syntax: object.style.marginLeft="100px" Try it[5] Browser SupportThe numbers in the table specify the first browser version that fully supports the property.
Property margin-left 1.0 6.0 1.0 1.0 3.5 CSS Syntaxmargin-left: length|auto|initial|inherit;
Property Values Value Description Demo length Specifies a fixed left margin in px, pt, cm, etc. Default value is 0...