Select a div when you mouse over a span element - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:hover

Description

Select a div when you mouse over a span element

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
div {<!--   w ww .j a  v a 2 s.  com-->
    background-color: yellow;
    padding: 20px;
    display: none;
}

span:hover + div {
    display: block;
}
</style>
</head>
<body>

<span>Hover over me!</span>
<div>hi from div</div>

</body>
</html>

Related Tutorials