left

  • Revision slug: CSS/left
  • Revision title: left
  • Revision id: 26464
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment 2 words added, 2 words removed

Revision Content

{{ CSSRef() }}

Summary

The left CSS property specifies part of the position of positioned elements.

For absolutely positioned elements (those with {{ Cssxref("position") }}: absolute or position: fixed), it specifies the distance between the left margin edge of the element and the left edge of its containing block.

<style type="text/css"></style>
  • {{ Xref_cssinitial() }}: {{ Cssxref("auto") }}
  • Applies to: positioned elements
  • {{ Xref_cssinherited() }}: no
  • Percentages: refer to width of containing block
  • Media: {{ Xref_cssvisual() }}
  • {{ Xref_csscomputed() }}: absolute length, percentage, or auto

Syntax

left: <length> | <percentage> | auto | inherit ;

Values

{{ Xref_csslength() }} 
A length, can be negative, zero, or positive.
{{ Xref_csspercentage() }} 
A percentage of the containing block's width.

Examples

{{ CSSLiveSample("css-positioning.html") }}

#example_3 {
  width: 600px;
  height: 400px;
  background-color: #FFC7E4;
  position: relative;
  top: 20px;
  left: 20px;
}

#example_4 {
  width:200px;
  height:200px;
  background-color: #FFD7C2;
  position:absolute;
  bottom:10px;
  right: 20px;
}

Specifications

Specification Status Comment
CSS Positioned Layout Module Level 3 {{ Spec2('CSS3 Positioning') }}  
CSS 2.1 {{ Spec2('CSS2.1') }}  

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 1.0 {{ CompatGeckoDesktop("1") }} 5.5 5.0 1.0
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support 1.0 {{ CompatGeckoMobile("1") }} 6.0 6.0 1.0

See also

{{ Cssxref("position") }}, {{ Cssxref("top") }}, {{ Cssxref("right") }}, {{ Cssxref("bottom") }}

 

{{ languages( { "de": "de/CSS/left", "es": "es/CSS/left", "pl": "pl/CSS/left" } ) }}

Revision Source

<p>{{ CSSRef() }}</p>
<h2 id="Summary" name="Summary">Summary</h2>
<p>The <code>left</code> CSS property specifies part of the position of positioned elements.</p>
<p>For absolutely positioned elements (those with {{ Cssxref("position") }}<code>: absolute</code> or <code>position: fixed</code>), it specifies the distance between the left margin edge of the element and the left edge of its containing block.</p>
<nobr>
<style type="text/css"><![CDATA[.cssprop {
  display:table;
  padding: 0.4em;
  border-left:0.15em solid;
  background-color:#eeeeff
}
.cssprop li {
 display:table-row;
 padding: 3px;
 margin:0;
}
.cssprop li dfn {
  display:table-cell;
  padding: 0 5px;
  border-bottom: none;
  cursor:inherit;
}

]]></style>
<ul class="cssprop"> <li><dfn>{{ Xref_cssinitial() }}:</dfn> {{ Cssxref("auto") }}</li> <li><dfn>Applies to:</dfn> <a href="/en/CSS/position" title="en/CSS/position">positioned elements</a></li> <li><dfn>{{ Xref_cssinherited() }}:</dfn> no</li> <li><dfn>Percentages:</dfn> refer to width of containing block</li> <li><dfn>Media:</dfn> {{ Xref_cssvisual() }}</li> <li><dfn>{{ Xref_csscomputed() }}:</dfn> absolute length, percentage, or auto</li>
</ul></nobr><h2 id="Syntax" name="Syntax">Syntax</h2>
<pre class="eval">left: &lt;length&gt; | &lt;percentage&gt; | auto | inherit ;
</pre>
<h3 id="Values" name="Values">Values</h3>
<dl> <dt>{{ Xref_csslength() }} </dt> <dd>A length, can be negative, zero, or positive.</dd> <dt>{{ Xref_csspercentage() }} </dt> <dd>A percentage of the containing block's width.</dd>
</dl>
<h2 id="Examples" name="Examples">Examples</h2>
<p>{{ CSSLiveSample("css-positioning.html") }}</p>
<pre class="eval">#example_3 {
  width: 600px;
  height: 400px;
  background-color: #FFC7E4;
  position: relative;
  top: 20px;
  left: 20px;
}

#example_4 {
  width:200px;
  height:200px;
  background-color: #FFD7C2;
  position:absolute;
  bottom:10px;
  right: 20px;
}</pre>
<h2 id="Notes" name="Notes">Specifications</h2>
<table class="standard-table"> <thead> <tr style="background-color: rgb(255, 204, 255);"> <th scope="col">Specification</th> <th scope="col">Status</th> <th scope="col">Comment</th> </tr> </thead> <tbody> <tr> <td><a class="external" href="http://dev.w3.org/csswg/css3-images/#repeating-gradients" title="http://dev.w3.org/csswg/css3-images/#repeating-gradients">CSS Positioned Layout Module Level 3</a></td> <td>{{ Spec2('CSS3 Positioning') }}</td> <td> </td> </tr> <tr> <td><a class="external" href="http://www.w3.org/TR/CSS21/visuren.html#propdef-left" title="http://www.w3.org/TR/CSS21/visuren.html#propdef-left">CSS 2.1</a></td> <td>{{ Spec2('CSS2.1') }}</td> <td> </td> </tr> </tbody>
</table>
<h2 id="Browser_Compatibility" name="Browser_Compatibility">Browser compatibility</h2>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Chrome</th> <th>Firefox (Gecko)</th> <th>Internet Explorer</th> <th>Opera</th> <th>Safari</th> </tr> <tr> <td>Basic support</td> <td>1.0</td> <td>{{ CompatGeckoDesktop("1") }}</td> <td>5.5</td> <td>5.0</td> <td>1.0</td> </tr> </tbody> </table>
</div>
<div id="compat-mobile"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Android</th> <th>Firefox Mobile (Gecko)</th> <th>IE Phone</th> <th>Opera Mobile</th> <th>Safari Mobile</th> </tr> <tr> <td>Basic support</td> <td>1.0</td> <td>{{ CompatGeckoMobile("1") }}</td> <td>6.0</td> <td>6.0</td> <td>1.0</td> </tr> </tbody> </table>
</div>
<h2 id="See_also" name="See_also">See also</h2>
<p>{{ Cssxref("position") }}, {{ Cssxref("top") }}, {{ Cssxref("right") }}, {{ Cssxref("bottom") }}</p>
<p> </p>
<p>{{ languages( { "de": "de/CSS/left", "es": "es/CSS/left", "pl": "pl/CSS/left" } ) }}</p>
Revert to this revision