From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- files/pl/web/css/_colon_last-child/index.html | 51 +++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 files/pl/web/css/_colon_last-child/index.html (limited to 'files/pl/web/css/_colon_last-child/index.html') diff --git a/files/pl/web/css/_colon_last-child/index.html b/files/pl/web/css/_colon_last-child/index.html new file mode 100644 index 0000000000..c051571b1f --- /dev/null +++ b/files/pl/web/css/_colon_last-child/index.html @@ -0,0 +1,51 @@ +--- +title: ':last-child' +slug: 'Web/CSS/:last-child' +tags: + - CSS + - 'CSS:Dokumentacje' + - Dokumentacje + - Wszystkie_kategorie +translation_of: 'Web/CSS/:last-child' +--- +

{{ CSSRef() }} +

+

Podsumowanie

+

Pseudoklasa :last-child sprawia iż własności stosowane są do elementu tylko wtedy gdy jest on ostatnim węzłem potomnym swojego rodzica. :last-child ignoruje węzły tekstowe. Pseudoklasą, która działa identycznie, jednak uwzględnia węzły tekstowe jest {{ Cssxref(":last-node") }}. +

+

Składnia

+
selektor:last-child { własności }
+
+

Przykłady

+
<html>
+  <body>
+  Trochę tekstu.
+    <span id="first">pierwszy</span>
+    <div>
+      <span id="dfirst">pierwszy</span>
+      <span id="dsecond">drugi</span>
+    </div>
+    <span id="second">drugi</span>
+  </body>
+</html>
+
+
span:last-child { font-weight: bold; }
+
+

Powyższy zapis pogrubi czcionkę wewnątrz wszystkich elementów span, które są ostatnimi dziećmi swoich rodziców. Zostaną tutaj pogrubione słowa "drugi":

+
  1. W pierwszym przypadku span o id dsecond jest ostatnim dzieckiem elementu div +
  2. W drugim przypadku span o id second jest ostatnim dzieckiem elementu body +
+


+

+
div:first-child:last-child { background-color: red; }
+
+

Ten przykład ustawi czerwony kolor tła wszystkim elementom div, które są jedynymi dziećmi swojego rodzica. +


+

+

Notatki

+

Zobacz także

+

{{ Cssxref(":before") }}, {{ Cssxref(":after") }}, {{ Cssxref(":first-child") }} +

+
+
+{{ languages( { "en": "en/CSS/:last-child", "fr": "fr/CSS/:first-child" } ) }} -- cgit v1.2.3-54-g00ecf