aboutsummaryrefslogtreecommitdiff
path: root/files/vi/web/css/_colon_first-child
diff options
context:
space:
mode:
Diffstat (limited to 'files/vi/web/css/_colon_first-child')
-rw-r--r--files/vi/web/css/_colon_first-child/index.html127
1 files changed, 127 insertions, 0 deletions
diff --git a/files/vi/web/css/_colon_first-child/index.html b/files/vi/web/css/_colon_first-child/index.html
new file mode 100644
index 0000000000..b02b008f18
--- /dev/null
+++ b/files/vi/web/css/_colon_first-child/index.html
@@ -0,0 +1,127 @@
+---
+title: ':first-child'
+slug: 'Web/CSS/:first-child'
+translation_of: 'Web/CSS/:first-child'
+---
+<div>{{CSSRef}}</div>
+
+<p><strong><code>:first-child</code></strong> <a href="/en-US/docs/Web/CSS">CSS</a> <a href="/en-US/docs/Web/CSS/Pseudo-classes">pseudo-class</a> đại diện cho phần tử đầu tiên trong số các phần tử anh chị em của nó.</p>
+
+<pre class="brush: css no-line-numbers">/* Chọn thẻ &lt;p&gt; đầu tiên trong số các thẻ anh chị em của nó*/
+p:first-child {
+ color: lime;
+}</pre>
+
+<div class="note">
+<p><strong>Note</strong>: As originally defined, the selected element had to have a parent. Beginning with Selectors Level 4, this is no longer required.</p>
+</div>
+
+<h2 id="Cú_pháp">Cú pháp</h2>
+
+<pre class="syntaxbox">{{csssyntax}}
+</pre>
+
+<h2 id="Ví_dụ">Ví dụ</h2>
+
+<h3 id="Ví_dụ_đơn_giản">Ví dụ đơn giản</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="Kết_quả">Kết quả</h4>
+
+<p><span>{{EmbedLiveSample('Basic_example', 500, 200)}}</span></p>
+
+<h3 id="Styling_một_danh_sách">Styling một danh sách</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="Result">Result</h4>
+
+<p>{{EmbedLiveSample('Styling_a_list')}}</p>
+
+<h2 id="Specifications">Specifications</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>Matching elements are not required to have a parent.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('CSS3 Selectors', '#first-child-pseudo', ':first-child')}}</td>
+ <td>{{Spec2('CSS3 Selectors')}}</td>
+ <td>No change.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('CSS2.1', 'selector.html#first-child', ':first-child')}}</td>
+ <td>{{Spec2('CSS2.1')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Khả_năng_tương_thích_của_trình_duyệt">Khả năng tương thích của trình duyệt</h2>
+
+
+
+<p>{{Compat("css.selectors.first-child")}}</p>
+
+<h2 id="Xem_thêm">Xem thêm</h2>
+
+<ul>
+ <li>{{CSSxRef(":-moz-first-node")}} {{Non-standard_Inline}}</li>
+ <li>{{CSSxRef(":first-of-type")}}</li>
+ <li>{{CSSxRef(":last-child")}}</li>
+ <li>{{CSSxRef(":nth-child")}}</li>
+</ul>