1/* Selecting a child element on :hover parent element*/
2.parent:hover .child {
3 /* ... */
4}
1<!DOCTYPE html>
2<html>
3<head>
4<style>
5.parent{
6 width: 500px;
7 height: 100px;
8 background-color: red;
9 cursor:pointer;
10}
11
12.parent:hover > .child{
13 animation-name: example;
14 animation-duration: 1s;
15 animation-timing-function: ease;
16}
17@keyframes example {
18 0% {margin-left:0px; color:white;}
19 50%{margin-left:200px;}
20}
21</style>
22</head>
23<body>
24
25<div class="parent">
26 <h3 class="child">hello js</h3>
27</div>
28
29</body>
30</html>
31