答案 0 :(得分:0)
将:before
元素的选择器更改为:
.parent:hover .hvr-underline-from-left:before
现在这个CSS在父母悬停时适用。
答案 1 :(得分:-1)
这里有html和js代码。
.container{
width: 100%;
height: 1000px;
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>GETTING STARTED WITH BRACKETS</title>
<link rel="stylesheet" href="main.css">
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script>
$(document).ready(function(){
});
$(window).scroll(function(){
$("#words").css('text-decoration','underline');
});
</script>
</head>
<body>
<div class="container">
<p id="words">
sdfgdsjafaghdf
</p>
</div>
</body>
</html>
&#13;