aboutsummaryrefslogtreecommitdiff
path: root/files/bg/web/css/_colon_first-child/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/bg/web/css/_colon_first-child/index.html')
-rw-r--r--files/bg/web/css/_colon_first-child/index.html117
1 files changed, 117 insertions, 0 deletions
diff --git a/files/bg/web/css/_colon_first-child/index.html b/files/bg/web/css/_colon_first-child/index.html
new file mode 100644
index 0000000000..799ab091ba
--- /dev/null
+++ b/files/bg/web/css/_colon_first-child/index.html
@@ -0,0 +1,117 @@
+---
+title: ':first-child'
+slug: 'Web/CSS/:first-child'
+tags:
+ - CSS
+ - Оформление
+ - Псевдоклас
+ - справочник
+translation_of: 'Web/CSS/:first-child'
+---
+<div>{{CSSRef}}</div>
+
+<p><span class="seoSummary"><a href="/bg/docs/Web/CSS">CSS</a> <a href="/bg/docs/Web/CSS/Pseudo-classes">псевдокласът</a> <code>:first-child</code> (:първо-дете) указва всеки елемент, намиращ се на първо място в списък с елементи от едно и също ниво в структурата на документа. В имплементациите на CSS3, за да бъде селектиран елемента, той трябва да има родител. В CSS4 това не е нужно.</span></p>
+
+<h2 id="Правопис">Правопис</h2>
+
+<pre class="syntaxbox">{{csssyntax}}
+</pre>
+
+<h2 id="Примери">Примери</h2>
+
+<h3 id="Пример_1">Пример 1</h3>
+
+<h4 id="HTML">HTML</h4>
+
+<pre class="brush: html">&lt;div&gt;
+ &lt;p&gt;This p is styled, as it is a p, AND the first
+ child in the div&lt;/p&gt;
+ &lt;p&gt;This p is not styled; it is not the first child!&lt;/p&gt;
+&lt;/div&gt;
+
+&lt;div&gt;
+ &lt;h2&gt;This h2 is not styled; it is not a p!&lt;/h2&gt;
+ &lt;p&gt;This p is not styled; it is not the first child!&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="Резултат">Резултат</h4>
+
+<p><span>{{EmbedLiveSample('Пример_1','100%',300)}}</span></p>
+
+<h3 id="Пример_2_-_с_използване_на_UL">Пример 2 - с използване на UL</h3>
+
+<h4 id="HTML_2">HTML</h4>
+
+<pre class="brush: html">&lt;ul&gt;
+ &lt;li&gt;List 1&lt;/li&gt;
+ &lt;li&gt;List 2&lt;/li&gt;
+ &lt;li&gt;List 3&lt;/li&gt;
+&lt;/ul&gt;</pre>
+
+<h4 id="CSS_2">CSS</h4>
+
+<pre class="brush: css">li{
+ color:blue;
+}
+li:first-child{
+ color:green;
+}</pre>
+
+<h4 id="Резултат_2">Резултат</h4>
+
+<p><span>{{EmbedLiveSample('Пример_2_-_с_използване_на_UL',300,100)}}</span></p>
+
+<h2 id="Спецификации">Спецификации</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('CSS4 Selectors', '#first-child-pseudo', ':first-child')}}</td>
+ <td>{{Spec2('CSS4 Selectors')}}</td>
+ <td>Елементите няма нужда да имат родител за да бъдат селектирани.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('CSS3 Selectors', '#first-child-pseudo', ':first-child')}}</td>
+ <td>{{Spec2('CSS3 Selectors')}}</td>
+ <td>Без промяна.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('CSS2.1', 'selector.html#first-child', ':first-child')}}</td>
+ <td>{{Spec2('CSS2.1')}}</td>
+ <td>Начална дефиниция.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Съвместимост_на_четците">Съвместимост на четците</h2>
+
+<div class="hidden">
+<p>The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+</div>
+
+<p>{{Compat("css.selectors.first-child")}}</p>
+
+<h2 id="Вижте_също">Вижте също</h2>
+
+<ul>
+ <li>{{cssxref(":last-child")}}</li>
+ <li>{{cssxref(":nth-child")}}</li>
+ <li>{{cssxref(":last-of-type")}}</li>
+</ul>