diff options
Diffstat (limited to 'files/bg/web/css/_colon_first-child/index.html')
-rw-r--r-- | files/bg/web/css/_colon_first-child/index.html | 117 |
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"><div> + <p>This p is styled, as it is a p, AND the first + child in the div</p> + <p>This p is not styled; it is not the first child!</p> +</div> + +<div> + <h2>This h2 is not styled; it is not a p!</h2> + <p>This p is not styled; it is not the first child!</p> +</div> +</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"><ul> + <li>List 1</li> + <li>List 2</li> + <li>List 3</li> +</ul></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> |