更改文本和背景颜色 CSS / HTML

保罗·怀特

我正在使用这个类来更改效果很好的背景和文本颜色。

#cellType1 {
  width: 10%;
  height: 83px;
  vertical-align: middle;
  background-image: url("Index.html")
}
#cellType1:hover {
color: white;
background-color: #6EBA37;
transition:0.6s;
}

...

<td id="cellType1" class="auto-style21" style="width: 10%">
      <a class="auto-style24" href="ContactUs.html">
      <span class="auto-style37">Contact Us </span></a></td>

auto-style21 工作正常,但是当我将文本更改为超链接时,我无法让文本更改颜色。

我知道这与样式有关,但是当鼠标悬停在单元格上时,我无法弄清楚如何控制超链接的文本。甚至在将鼠标悬停在文本上时更改文本的颜色也可以。

我更喜欢在鼠标进入单元格时更改文本。

布里斯贝

您需要直接或间接定位 A,而不是单元格的悬停,以使样式应用于链接。

如果您希望根据单元格本身的悬停来更改链接,您可以使用以下内容:

更改这部分代码:

#cellType1:hover {
color: white;
background-color: #6EBA37;
transition:0.6s;
}

对此:

#cellType1:hover {
color: white;
background-color: #6EBA37;
transition:0.6s;
}

#cellType1:hover a {
color: white;
transition:0.6s;
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章