A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/css/properties/margin-left below:

margin-left · WebPlatform Docs

margin-left Summary

margin-left sets the left margin of an element.

Overview table
Initial value
Depends on the particular element. Different elements have different default margins.
Applies to
All elements
Inherited
No
Media
visual
Computed value
As specified, but with relative lengths converted into absolute pixel values.
Animatable
No
CSS Object Model Property
marginLeft
Syntax Values
length
Specifies a fixed length, using any standard CSS length units . Negative Values are allowed.
percentage
A percentage of the width of the containing block. Negative values are allowed. (Even though this is margin-top, the browser will take the percentage from the width, not the height of the containing block.)
auto
The browser calculates a left margin dependent on the space available.
inherit
Inherits the parent element’s specified margin-left width.
Examples

In this example there are three blocks, styled identically except for their margin-left values:

<div class="one"></div>
<div class="two"></div>
<div class="three"></div>

View live example

CSS applied to the HTML shown in the first example.



 * {
   margin: 0;
 }

 div {
   width: 200px;
   height: 100px;
   background: linear-gradient(rgba(0,0,0,0.25), rgba(0,0,0,0));
   border-radius: 10px;
 }

 .one {
   background-color: red;
   margin-left: 2cm;
 }

 .two {
   background-color: blue;
 }

 .three {
   background-color: green;
   margin-left: -10%;
 }

View live example

Usage
 ===Usage===
Best Practices Notes

You can specify possible length values relative to the height of the element’s font (em) or the height of the letter “x” (ex). In Microsoft Internet Explorer 3.0, the specified margin value is added to the default value of the object. In Microsoft Internet Explorer 4.0 and later, the margin value is absolute. The margin properties do not work with the td and tr objects in Internet Explorer 4.0, but they do work in Internet Explorer 3.0. To set margins in the cell for Internet Explorer 4.0 and later, apply the margin to an object, such as div or p, within the td. This property applies to inline elements, starting with Microsoft Internet Explorer 5.5. With earlier versions of Windows Internet Explorer, inline elements must have an absolute position or layout to use this property. Element layout is set by providing a value for the height property or the width property. Negative margins are supported, except for top and bottom margins on inline objects.

Standards Information

w3.org

Related specifications
CSS 2
W3C Recommendation
See also Related articles Box Model Related pages Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4