CSS Selector :only-of-type
Description
The :only-of-type
selector matches elements
that are the only child of their type.
Example
<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
:only-of-type { <!-- ww w. jav a2 s .com-->
border: thin black solid;
padding: 4px;
}
</style>
</head>
<body>
<a href="http://java2s.com">Visit the java2s.com</a>
<p>I like <span>HTML</span> and CSS.</p>
<p>I like <span>HTML</span> and CSS.</p>
<p>I like <span>HTML</span> and CSS.</p>
</body>
</html>
The code above generates the following result.