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

WordPress修改激活标签文字颜色及页眉高度的代码求助

Fixing WordPress Header Height & Active Page Tab Text Color

Hey there! Let’s sort out those two customization tweaks you need for your WordPress site. Below are the CSS snippets you can use, plus tips to make sure they work smoothly with your theme:

1. Adjust Header Height

Add this CSS to modify your site’s header height—tweak the pixel value to match your design needs:

/* Adjust header height (replace selector if your theme uses a different class/ID) */
.site-header {
  height: 90px; /* Change this number to your desired height */
}

Note: If .site-header doesn’t target your header correctly, use your browser’s inspect tool (right-click the header → Inspect) to find the exact class or ID your theme uses (common alternatives include .header or #masthead).

2. Change Active Page Tab Text Color

Use this snippet to set a custom color for the active page’s menu text. Replace the hex code with your preferred color:

/* Change active menu item text color */
.current-menu-item a {
  color: #2c3e50 !important; /* Swap this hex code for your desired color */
}

The !important flag helps override your theme’s default styles—if the color works without it (test first), feel free to remove that part.

How to Add This CSS Safely

You have two reliable ways to apply this code to your site:

  • Go to Appearance → Customize → Additional CSS in your WordPress dashboard, paste the code there, and click "Publish".
  • If you’re using a child theme, add the code to your child theme’s style.css file (this ensures your changes won’t get lost when the parent theme updates).

内容的提问来源于stack exchange,提问作者Marios T.

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.26 08:42:14