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

如何在WordPress站点中修改联系框CSS类的字体颜色?

Fixing Text Color in Your WordPress Contact Box

Hey Jaydon, let's get that contact box text color sorted out once and for all! Here's a straightforward, step-by-step approach to make all those text lines consistent:

1. Pinpoint the Right CSS Selector

First, we need to identify exactly which CSS class or element is making that text white. Here's how to do it easily:

  • Right-click on any of the white text lines in your contact box and select Inspect (this works in Chrome, Firefox, Edge, etc.).
  • In the developer tools panel that pops up, look at the HTML element wrapping the text—it might be a <p>, <span>, or a custom class like .contact-detail-text.
  • Jot down the full selector path (for example, if the text lives inside a <div class="contact-info-item">, your selector could be .contact-info-item or .contact-info-item p).

2. Add Custom CSS to Your WordPress Site

Once you have the selector, add this custom CSS to your site (no theme file edits needed):

  1. Log into your WordPress dashboard.
  2. Navigate to Appearance > Customize > Additional CSS—this is the safest place to add custom styles without breaking your theme.
  3. Paste in code like this, replacing the placeholder selector with the one you found:
/* Set contact box text to black */
.your-target-selector {
    color: #000 !important; /* Swap #000 for any hex color you want, like #333 for dark gray */
}
  • The !important flag helps override any existing styles forcing the text to white. If the color updates without it, feel free to remove !important (it's best to avoid overusing it when possible).

3. Test and Tweak

Click Publish in the customizer, then refresh your site's page to check the result. If some lines still don't change, head back to the inspector tool—sometimes nested elements have their own color styles, so you might need to adjust the selector to target deeper (e.g., .contact-box .info-item span instead of just .info-item).

For example, if your contact box structure looks like this:

<div class="contact-box">
  <div class="info-item">
    <i class="contact-icon"></i>
    <p>First line (black via HTML)</p>
    <p>Second line (white by default)</p>
  </div>
</div>

Using .contact-box .info-item p as your selector will target all <p> tags inside the info item, making every line match the black color you want.

内容的提问来源于stack exchange,提问作者Jaydon May

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.19 10:29:19