--- title: right slug: Web/CSS/right tags: - CSS - CSS Property - Własność CSS - border translation_of: Web/CSS/right ---
Własność CSS right pełni ważną rolę w określaniu pionowej pozycji pozycjonowanego elementu. Nie ma wpływu na elementy z nieokreślonym położeniem.
{{EmbedInteractiveExample("pages/css/right.html")}}
Efekt right jest zależny od pozycji elementu (czyli od własności position elementu).
position is set to absolute or fixed, the right property specifies the distance between the element's right edge and the right edge of its containing block.position is set to relative, the right property specifies the distance the element's right edge is moved to the left from its normal position.position is set to sticky, the right property behaves like its position is relative when the element is inside the viewport, and like its position is fixed when it is outside.position is set to static, the right property has no effect.When both {{cssxref("left")}} and right are defined, and the element cannot stretch to satisfy both, the position of the element is overspecified. When this is the case, the left value has precedence when the container is left-to-right; the right value has precedence when the container is right-to-left.
/* Wartość liczbowa (długość) */ right: 3px; right: 2.4em; /* Wartość procentowa */ right: 10%; /* Wartość kluczowa */ right: auto; /* Wartości globalne */ right: inherit; right: initial; right: unset;
null długość, która dla:position: absolute, określa odległość do prawej krawędzi rodzicaposition: relative, określa czy element jest przeniesiony do lewej krawędzi jej normalnej (domyślnej) pozycjiautowidth: auto is treated as a width based on the content; or if left is also auto, the element is positioned where it should horizontally be positioned if it were a static element.left is also auto, the element is not moved horizontally at all.inheritauto keyword.#example_3 {
width: 100px;
height: 100px;
background-color: #FFC7E4;
position: relative;
top: 20px;
left: 20px;
}
#example_4 {
width: 100px;
height: 100px;
background-color: #FFD7C2;
position: absolute;
bottom: 10px;
right: 20px;
}
<div id="example_3">Example 3</div> <div id="example_4">Example 4</div>
{{ EmbedLiveSample('Examples', 500, 220) }}
| Specyfikacja | Status | Komentarz |
|---|---|---|
| {{SpecName('CSS3 Transitions', '#animatable-css', 'right')}} | {{Spec2('CSS3 Transitions')}} | Definiuje right jako animatable (możliwy do animowania) |
| {{SpecName('CSS3 Positioning', '#propdef-right', 'right')}} | {{Spec2('CSS3 Positioning')}} |
Określa zachowanie dla |
| {{SpecName('CSS2.1', 'visuren.html#propdef-right', 'right')}} | {{Spec2('CSS2.1')}} |
Initial definition. |
{{cssinfo}}
{{Compat("css.properties.right")}}