最佳答案
如果该文本在您的框内(一个 child ),那么您可以这样做。如果你想为不同的文本添加不同的颜色,应该使用下面的代码片段
.box {
width: 100%;
height: 300px;
border: 1px solid red;
}
.box:hover {
background: blue;
}
.box:hover p {
color: white;
}
.box:hover h1 {
color:red;
}
<div class="box">
<h1>Title will become red on hover</h1>
<p>
Some text Here will become white on hover
</p>
</div>
如果您想更改该框内的所有文本颜色,请使用 .box:hover { background-color:blue;color:white;}
关于html - 我想要我的标题的双悬停 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45476319/