You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

设置页脚链接样式后博客文章文本变白的技术咨询

问题原因

你的CSS选择器a:link、a:visited、a:hover是全局生效的,会匹配页面中所有的<a>标签,所以博客文章里的链接也被强制改成了白色。

解决方案

给CSS选择器加上footer前缀,让样式仅作用于页脚内部的链接:

footer a:link {
  color: White;
  background-color: transparent;
  text-decoration: none;
}
footer a:visited {
  color: White;
  background-color: transparent;
  text-decoration: none;
}
footer a:hover {
  color: White;
  background-color: transparent;
  text-decoration: underline;
}

你的HTML代码无需修改,保持原样即可:

<footer>
  <a href="https://tasteveryday.com/"><h5>Home</h5></a><a href="https://tasteveryday.com/about-us/"><h5>About Us</h5></a><a href="https://tasteveryday.com/contact/"><h5>Contact</h5></a><a href="https://tasteveryday.com/privacy-policy/"><h5>Privacy Policy</h5></a><a href="https://tasteveryday.com/term-of-use/"><h5>Terms Of Use</h5></a>
</footer>

修改后,只有页脚内的链接会应用白色样式,博客文章中的链接不会再被影响。

内容的提问来源于stack exchange,提问作者Souhail Hajib

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.25 08:45:59