--- title: left slug: Web/CSS/Left tags: - CSS - CSS Eigenschaft - CSS Positionierung - Referenz translation_of: Web/CSS/left --- <p>{{CSSRef}}</p> <h2 id="Übersicht">Übersicht</h2> <p>Die CSS Eigenschaft <code>left</code> definiert einen Teil der Position von positionierten Elementen.</p> <p>Bei absolut positionierten Elementen (jene mit {{cssxref("position")}}<code>: absolute</code> oder <code>position: fixed</code>) wird der Abstand zwischen der linken, äußeren Rand des Elements und dem linken Rand des umschließenden Blocks definiert.</p> <p>{{cssinfo}}</p> <h2 id="Syntax">Syntax</h2> <pre class="brush:css">/* <length> Werte */ left: 3px; left: 2.4em; /* <percentage> Werte bezogen auf die Breite des beinhaltenden Blocks */ left: 10%; /* Schlüsselwortwerte */ left: auto; /* Globale Werte */ left: inherit; left: initial; left: unset; </pre> <h3 id="Werte">Werte</h3> <dl> <dt><code><length></code></dt> <dd>Ist eine negative, null oder positive {{cssxref("<length>")}}, die folgendem entspricht: <ul> <li>für <em>absolute positionierte Elemente</em>, die Distanz zum linken Rand des beinhaltenden Blocks</li> <li>für <em>relativ positionierte Elemente</em>, der Versatz, um den das Element von seiner Position im normalen Fluss nach links verschoben ist, falls es nicht positioniert wäre.</li> </ul> </dd> <dt><code><percentage></code></dt> <dd>Ein {{cssxref("<percentage>")}} Wert der Breite des beinhaltenden Blocks, wie in der <a href="#Übersicht">Übersicht</a> beschrieben.</dd> <dt><code>auto</code></dt> <dd>Ist ein Schlüsselwort, das folgendem entspricht: <ul> <li>für absolut positionierte Elemente, die Position des Elements basierend auf der {{cssxref("right")}} Eigenschaft und <code>width: auto</code> wird als Breite basierend auf dem Inhalt behandelt.</li> <li>für relativ positionierte Elemente, der linke Versatz des Elements von der Originalposition basierend auf der {{cssxref("right")}} Eigenschaft oder falls <code>right</code> ebenfalls <code>auto</code> ist, wird wird es nicht verschoben.</li> </ul> </dd> </dl> <h2 id="Beispiele">Beispiele</h2> <h3 id="CSS">CSS</h3> <pre class="brush: css">#wrap { width: 700px; margin: 0 auto; background: #5C5C5C; } pre { white-space: pre; white-space: pre-wrap; white-space: pre-line; word-wrap: break-word; } #example_1 { width: 200px; height: 200px; position: absolute; left: 20px; top: 20px; background-color: #D8F5FF; } #example_2 { width: 200px; height: 200px; position: relative; top: 0; right: 0; background-color: #C1FFDB; } #example_3 { width: 600px; height: 400px; position: relative; top: 20px; left: 20px; background-color: #FFD7C2; } #example_4 { width: 200px; height: 200px; position: absolute; bottom: 10px; right: 20px; background-color: #FFC7E4; }</pre> <h3 id="HTML">HTML</h3> <pre class="brush: html"><div id="wrap"> <div id="example_1"> <pre> position: absolute; left: 20px; top: 20px; </pre> <p>Das einzige Element, das dieser Div beinhaltet, ist das Hauptfenster. Daher positioniert er sich in Bezug dazu.</p> </div> <div id="example_2"> <pre> position: relative; top: 0; right: 0; </pre> <p>Relative Position in Bezug auf seine Geschwisterelemente.</p> </div> <div id="example_3"> <pre> float: right; position: relative; top: 20px; left: 20px; </pre> <p>Relativ zu seinem Geschwister-Div darüber, jedoch aus dem Inhaltsfluss entfernt.</p> <div id="example_4"> <pre> position: absolute; top: 10px; left: 20px; </pre> <p>Absolute Position innerhalb des Elternelements mit relativer Position.</p> </div> </div> </div></pre> <h3 id="Live_Beispiel">Live Beispiel</h3> <p>{{EmbedLiveSample('Beispiele', 1200, 650)}}</p> <h2 id="Spezifikationen">Spezifikationen</h2> <table class="standard-table"> <thead> <tr> <th scope="col">Spezifikation</th> <th scope="col">Status</th> <th scope="col">Kommentar</th> </tr> </thead> <tbody> <tr> <td>{{SpecName('CSS3 Transitions', '#animatable-css', 'left')}}</td> <td>{{Spec2('CSS3 Transitions')}}</td> <td>Definiert <code>left</code> als animierbar.</td> </tr> <tr> <td>{{SpecName('CSS2.1', 'visuren.html#propdef-left', 'left')}}</td> <td>{{Spec2('CSS2.1')}}</td> <td>Ursprüngliche Definition</td> </tr> </tbody> </table> <h2 id="Browser_Kompatibilität">Browser Kompatibilität</h2> {{Compat("css.properties.left")}} <h2 id="Siehe_auch">Siehe auch</h2> <ul> <li>{{cssxref("position")}}, {{cssxref("right")}}, {{cssxref("bottom")}}, {{cssxref("left")}}</li> </ul>