Copyright © tutorialspoint.com

CSS - margin-left

previous next


Description:

The margin-left property sets the width of the margin on the left of an element.

Possible Values:

Applies to:

All the HTML elements

DOM Syntax:

object.style.marginLeft="5px"

Example:

Here is the example:

<p style="margin-left: 15px; border:1px solid black;">
This is a paragraph with a specified left margin
</p>

<p style="margin-left: 5%; border:1px solid black;">
This is another paragraph with a specified top margin in percent
</p>

This will produce following result:

This is a paragraph with a specified left margin

This is another paragraph with a specified top margin in percent

To Become more comfortable - Do Online Practice


previous next

Copyright © tutorialspoint.com