:only-child
In this chapter you will learn:
Description
The :only-child
selector
matches the only child element.
Example
<!DOCTYPE HTML> <!-- ja v a 2s. c o m-->
<html>
<head>
<style type="text/css">
:only-child {
border: thin black solid;
padding: 4px;
}
</style>
</head>
<body>
<p>I like <span>HTML</span> and CSS.</p>
<a href="http://java2s.com">Visit the java2s.com</a>
</body>
</html>
Next chapter...
What you will learn in the next chapter:
Home » HTML CSS Tutorial » CSS Selector Reference