The :only-of-type
selector matches elements
that are the only child of their type.
:only-of-type { style properties }
:only-of-type |
Yes | 9.0 | Yes | Yes | Yes |
An example showing how to use :only-of-type CSS selector.
<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
:only-of-type { <!-- w w w.j ava 2 s . c o m-->
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>