如何修改Contact Form 7输入框文本颜色(灰色转白色)
临时解决Contact Form 7输入框文本颜色被覆盖的方案
快速强制覆盖方案
用 !important 声明强制覆盖现有CSS规则,这是最直接的临时解决方法:
针对所有文本/邮箱输入框
.wpcf7-form input[type="text"], .wpcf7-form input[type="email"] { color: #ffffff !important; }
针对特定两个输入框
如果只想修改指定的两个输入框,先在Contact Form 7后台给这两个输入框添加自定义类(比如 white-text),示例CF7短代码:
[text* your-name class:white-text] [email* your-email class:white-text]
然后用以下CSS:
.wpcf7-form .white-text { color: #ffffff !important; }
后续优化建议(非临时)
临时方案生效后,建议移除 !important,通过提升选择器优先级来实现持久化修改,比如结合表单的父容器类:
.your-form-parent-class .wpcf7-form input[type="text"] { color: #ffffff; }
内容的提问来源于stack exchange,提问作者Lordp
相关产品推荐
相关产品推荐

