CSS Structural pseudoclasses - Part 3

Notes:

CSS - Pseudo Class Selectors (Structural) - Part 3

6.
selector : only-of-type
{
declaration list;
}
It selects any html element targeted by the selector, if it is the only child of its type in its parent html element

Ex:
p: only-of-type
{
border:2px solid red;
}
It selects any p element, if it is the only child of its type in its parent html element

7.
selector : first-of-type
{
declaration list;
}
It selects any html element targeted by the selector, if it is the first child of its type in its parent html element

Ex:
p: first-of-type
{
border:2px solid red;
}
It selects any p element, if it is the first child of p type in its parent html element

8.
selector : last-of-type
{
declaration list;
}
It selects any html element targeted by the selector, if it is the last child of its type in its parent html element

Ex:
p: last-of-type
{
border:2px solid red;
}
It selects any p element, if it is the last child of p type in its parent html element.

Interview Questions: