aboutsummaryrefslogtreecommitdiff
path: root/files/ca/web/css/_colon_first-child
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:15 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:15 -0500
commit4b1a9203c547c019fc5398082ae19a3f3d4c3efe (patch)
treed4a40e13ceeb9f85479605110a76e7a4d5f3b56b /files/ca/web/css/_colon_first-child
parent33058f2b292b3a581333bdfb21b8f671898c5060 (diff)
downloadtranslated-content-4b1a9203c547c019fc5398082ae19a3f3d4c3efe.tar.gz
translated-content-4b1a9203c547c019fc5398082ae19a3f3d4c3efe.tar.bz2
translated-content-4b1a9203c547c019fc5398082ae19a3f3d4c3efe.zip
initial commit
Diffstat (limited to 'files/ca/web/css/_colon_first-child')
-rw-r--r--files/ca/web/css/_colon_first-child/index.html203
1 files changed, 203 insertions, 0 deletions
diff --git a/files/ca/web/css/_colon_first-child/index.html b/files/ca/web/css/_colon_first-child/index.html
new file mode 100644
index 0000000000..7a226ce95e
--- /dev/null
+++ b/files/ca/web/css/_colon_first-child/index.html
@@ -0,0 +1,203 @@
+---
+title: ':first-child'
+slug: 'Web/CSS/:first-child'
+tags:
+ - CSS
+ - Layout
+ - Pseudo-class
+ - Reference
+ - Web
+translation_of: 'Web/CSS/:first-child'
+---
+<div>{{CSSRef}}</div>
+
+<p>La <a href="/en-US/docs/Web/CSS/Pseudo-classes">pseudo-class</a> <a href="/en-US/docs/Web/CSS">CSS</a> <strong><code>:first-child</code></strong> <span id="result_box" lang="ca"><span>representa el primer element entre un grup d'elements germans.</span></span></p>
+
+<pre class="brush: css no-line-numbers">/* <span id="result_box" lang="ca"><span>Selecciona qualsevol &lt;p&gt; que sigui el primer element entre els seus germans</span></span> */
+p:first-child {
+ color: lime;
+}</pre>
+
+<div class="note">
+<p><strong>Nota</strong>: Com es va definir originalment, l'element seleccionat havia de tenir un pare. A partir dels Selectores Nivell 4, això ja no és necessari.</p>
+</div>
+
+<h2 id="Sintaxi">Sintaxi</h2>
+
+<pre class="syntaxbox">{{csssyntax}}
+</pre>
+
+<h2 id="Exemples">Exemples</h2>
+
+<h3 id="Exemple_bàsic">Exemple bàsic</h3>
+
+<h4 id="HTML">HTML</h4>
+
+<pre class="brush: html">&lt;div&gt;
+ &lt;p&gt;This text is selected!&lt;/p&gt;
+ &lt;p&gt;This text isn't selected.&lt;/p&gt;
+&lt;/div&gt;
+
+&lt;div&gt;
+ &lt;h2&gt;This text isn't selected: it's not a `p`.&lt;/h2&gt;
+ &lt;p&gt;This text isn't selected.&lt;/p&gt;
+&lt;/div&gt;
+</pre>
+
+<h4 id="CSS">CSS</h4>
+
+<pre class="brush: css">p:first-child {
+ color: lime;
+ background-color: black;
+ padding: 5px;
+}
+</pre>
+
+<h4 id="Resultat">Resultat</h4>
+
+<p><span>{{EmbedLiveSample('Basic_example', 500, 200)}}</span></p>
+
+<h3 id="Disseny_d'una_llista"><span class="short_text" id="result_box" lang="ca"><span>Disseny d'una llista</span></span></h3>
+
+<h4 id="HTML_2">HTML</h4>
+
+<pre class="brush: html">&lt;ul&gt;
+ &lt;li&gt;Item 1&lt;/li&gt;
+ &lt;li&gt;Item 2&lt;/li&gt;
+ &lt;li&gt;Item 3
+ &lt;ul&gt;
+ &lt;li&gt;Item 3.1&lt;/li&gt;
+ &lt;li&gt;Item 3.2&lt;/li&gt;
+ &lt;li&gt;Item 3.3&lt;/li&gt;
+ &lt;/ul&gt;
+ &lt;/li&gt;
+&lt;/ul&gt;</pre>
+
+<h4 id="CSS_2">CSS</h4>
+
+<pre class="brush: css">ul li {
+ color: blue;
+}
+
+ul li:first-child {
+ color: red;
+ font-weight: bold;
+}</pre>
+
+<h4 id="Resultat_2">Resultat</h4>
+
+<p><span>{{EmbedLiveSample('Styling_a_list')}}</span></p>
+
+<h2 id="Especificacions">Especificacions</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Especificació</th>
+ <th scope="col">Estat</th>
+ <th scope="col">Comentari</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('CSS4 Selectors', '#first-child-pseudo', ':first-child')}}</td>
+ <td>{{Spec2('CSS4 Selectors')}}</td>
+ <td><span id="result_box" lang="ca"><span>No es requereix que els elements coincidents tinguin un pare</span></span>.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('CSS3 Selectors', '#first-child-pseudo', ':first-child')}}</td>
+ <td>{{Spec2('CSS3 Selectors')}}</td>
+ <td>Cap canvi.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('CSS2.1', 'selector.html#first-child', ':first-child')}}</td>
+ <td>{{Spec2('CSS2.1')}}</td>
+ <td>Definició inicial.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Navegadors_compatibles">Navegadors compatibles</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Descripció</th>
+ <th>Chrome</th>
+ <th>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Suport bàsic</td>
+ <td>4.0</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop("1.9")}}</td>
+ <td>7<sup>[1]</sup></td>
+ <td>{{CompatOpera(9.5)}}</td>
+ <td>4</td>
+ </tr>
+ <tr>
+ <td>No es requereix cap pare</td>
+ <td>{{CompatChrome(57)}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoDesktop("51")}}<sup>[2]</sup></td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatOpera(44)}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Descripció</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Edge</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Suport bàsic</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoMobile("1.9.1")}}</td>
+ <td>7<sup>[1]</sup></td>
+ <td>{{CompatOperaMobile(10)}}</td>
+ <td>3.1</td>
+ </tr>
+ <tr>
+ <td>No es requereix cap pare</td>
+ <td>{{CompatChrome(57)}}</td>
+ <td>{{CompatChrome(57)}}</td>
+ <td>{{CompatGeckoMobile("51")}}<sup>[2]</sup></td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatOperaMobile(44)}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p>[1] Internet Explorer 7 no actualitza els estils quan s'afegeixen elements dinàmicament. A Internet Explorer 8, si un element s'insereix de forma dinàmica fent clic en un enllaç, l'estil del primer fill no s'aplica fins que l'enllaç no ha perdut el focus.</p>
+
+<p>[2] Veure {{bug(1300374)}}.</p>
+
+<h2 id="Vegeu_també">Vegeu també</h2>
+
+<ul>
+ <li>{{cssxref(":first-of-type")}}, {{cssxref(":last-child")}}, {{cssxref(":nth-child")}}</li>
+</ul>