gpt4 book ai didi

css - 在 HTML,CSS 中更改鼠标悬停时的瓷砖颜色

转载 作者:行者123 更新时间:2023-11-28 08:22:24 25 4
gpt4 key购买 nike

<html>
<head>
<style>


.box {
float: left;
width: 175px;
height: 100px;
margin: 0.2em;
background color: DarkGray;
}

.head{
color: green;
}

h1{
color: white;
text-align: center;
height: 2%;
margin-top: auto;
margin-bottom: auto;
}

p{
color: LightSalmon;
text-align: center;
height: 5%;
margin-top: auto;
margin-bottom: auto;
}
a:link{
text-decoration: none;
}
a:visited{
text-decoration: none;
}
a:active{
text-decoration: none;
}
a :hover{
text-decoration: none;color:green;background-color: yellow;
}

</style>
</head>
<body>
<h1 class="head">
MY BLOCKS
</h1>
<a href="https://www.google.co.uk" target="_blank"><div class="box"><h1>Block0</h1><p>It is a floating Block0</p></div></a>
</body>
</html>

在这段代码中,我需要在鼠标悬停时更改“div”的颜色……我已经尝试了几乎所有我在网上找到的东西,包括这里的提示。没用。请帮忙。我可以用什么替换行,

a :hover{
text-decoration: none;color:green;background-color: yellow;
}

我试过了

.box a :hover{
text-decoration: none;color:green;background-color: yellow;
}

 a :hover box{
text-decoration: none;color:green;background-color: yellow;
}

 a box:hover{
text-decoration: none;color:green;background-color: yellow;
}

等...

最佳答案

最好使用a标签的悬停状态。

a:hover .box {color:green;背景色:黄色;

关于css - 在 HTML,CSS 中更改鼠标悬停时的瓷砖颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28698420/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com