Important Notice:

Course Content
Float Property
0/1
Z-Index
0/1
CSS object-fit Property
0/1
CSS Visibility Property
0/1
CSS (Chapter 4) M2-R5.1
About Lesson

:nth-of-type()

         यदि आप सिर्फ किसी Particular Type के Child Element को Target करना चाहते हैं तो इस Class का इस्तेमाल कीजिए।जैसे आप Container में उपलब्ध अन्य Elements को छोडकर केवल P Elements को Target करना चाहते हैं तो ऐसा इस Class द्वारा किया जा सकता हैं। आप जिस क्रम के Element को Target करना चाहते हैं उसका क्रम () में लिखा जाता हैं।

 

:nth-of-type()

          If you want to target only a particular type of child element, then use this class. For example, if you want to target only P elements excluding other elements available in the container, then this can be done by this class. The order of the element you want to target is written in ().

Example:

<html>

<head>

<style>

p:nth-of-type(2)

{  

background-color:yellow;

}

</style>

</head>

<body>

<div>

<span>This is first span of Div.</span>

<p>This is first paragraph of Div.</p>

<span>This is second span of Div</span>

<p>This is second paragraph of Div.</p>

</div>

</body>

</html>

 

 

 

 

error: Content is protected !!