简体   繁体   English

如何更改所选菜单文本颜色或下划线 - WordPress

[英]How to change selected menu text color or underline - WordPress

I've browsed all of the other questions on this topic and tried all of the sample code that was provided, but I still can't seem to get a fix after a few hours, so here I am.我浏览了有关该主题的所有其他问题并尝试了提供的所有示例代码,但几个小时后我似乎仍然无法修复,所以我在这里。

I am trying to change the color of the selected menu page for my site's navigation.我正在尝试为我的网站导航更改所选菜单页面的颜色。 I am using the Astra theme, and Elementor Page builder.我正在使用 Astra 主题和 Elementor Page 构建器。 I went into WP customizer and made my selections for link color and link hover color, but it seems those changes only take effect when I am on the "Shop" page of my menu.我进入 WP 定制器并选择了链接颜色和链接 hover 颜色,但似乎这些更改仅在我在菜单的“商店”页面上时生效。 The only difference I can see with the "Shop" menu text is it is a custom link, rather than the starter theme default link?我可以看到“商店”菜单文本的唯一区别是它是自定义链接,而不是入门主题默认链接? Pictures attached to show what I am talking about.附上图片以显示我在说什么。

Red orange color when "Home" is selected选择“主页”时为红橙色

When "Shop" is selected it takes my selected link color from my global color settings. When "Shop" is selected it takes my selected link color from my global color settings. This is the only one that appears to be doing what I asked of it in the UI这是唯一一个似乎在做我在 UI 中要求它做的事情

The rest of the menu text does the same thing "Home" does - it draws the red orange color from an unknown source, and I don't know what the color code is or where to find it.菜单文本的 rest 与“Home”做同样的事情 - 它从未知来源绘制红橙色,我不知道颜色代码是什么或在哪里可以找到它。

I'm trying to either change the selected menu text color away from that red orange color to another custom color -- or keep all of the text as the grey color and make the menu text underlined when hovered over or selected.我正在尝试将选定的菜单文本颜色从红色橙色更改为另一种自定义颜色 - 或者将所有文本保持为灰色并在悬停或选择时使菜单文本带下划线。 Issue is I can't seem to make a change consistent when navigating across the menu items.问题是我在浏览菜单项时似乎无法做出一致的更改。 Help would be greatly appreciated!帮助将不胜感激!

Write a custom CSS property, use this CSS class for your menu.编写自定义 CSS 属性,使用此 CSS class 为您的菜单。

  • Appearance - Customise - Custom CSS (Write your custom CSS here)外观 - 自定义 - 自定义 CSS(在此处编写您的自定义 CSS)

  • Appearance - Menus - Header/Main Menu At the top of the page, you should the "Screen Option" menu... Click on it and enable(check) the CSS class box.外观 - 菜单 - 标题/主菜单 在页面顶部,您应该选择“屏幕选项”菜单...单击它并启用(选中)CSS class 框。

Now, click on your menu items and specify the CSS class to each menu items.现在,单击您的菜单项并为每个菜单项指定 CSS class。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM