:first-of-typeकिसी दिए गए वर्ग के नाम के साथ पहले तत्व का चयन करने के लिए CSS3 चयनकर्ता का उपयोग करना संभव है ? मैं अपने परीक्षण में सफल नहीं हुआ, इसलिए मैं सोच रहा हूं कि यह नहीं है?
कोड ( http://jsfiddle.net/YWY4L/ ):
p:first-of-type {color:blue}
p.myclass1:first-of-type {color:red}
.myclass2:first-of-type {color:green}
<div>
<div>This text should appear as normal</div>
<p>This text should be blue.</p>
<p class="myclass1">This text should appear red.</p>
<p class="myclass2">This text should appear green.</p>
</div>
.myclass1चयनकर्ता के प्रत्येक तत्व का चयन करेंगे.myclass1। चयनकर्ता.myclass1 ~ .myclass1सामान्य सिबलिंग कॉम्बीनेटर का उपयोग उस वर्ग के साथ प्रत्येक तत्व का चयन करने के लिए करता.myclass1है जो निम्न वर्ग के साथ एक तत्व का निम्न सिबलिंग है.myclass1। यह यहाँ आश्चर्यजनक विस्तार से समझाया गया है ।