动态设置悬停颜色

发布于 2025-02-13 10:37:30 字数 443 浏览 1 评论 0原文

我正在使用Drupal,并创建了一个颜色字段,用于在变量中使用以不同的内容,其中有一个转储的示例:

“

我在树枝中的内容上使用它这样:

<p style="{{ node_color ? 'color:' ~ node_color }}">{{ content.field_formated_title.0 }}</p>

现在我想在悬停按钮上使用这种颜色,但是我真的不知道该怎么做,我应该在我的CSS还是JS?

I'm using drupal and I created a color field to be used in variable to make contents with differents color, there is an example of a dump :

enter image description here

and I use it like this on my content in twig :

<p style="{{ node_color ? 'color:' ~ node_color }}">{{ content.field_formated_title.0 }}</p>

Now I want to use this color on hover buttons, but I don't really know how to do that, should I do something in my css or js?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

三岁铭 2025-02-20 10:37:30

普通CSS是用于样式的,因此我会编写自定义CSS文件并在那里写悬停CS。

抱歉,我不知道您的方式是否有命令 - 找不到任何东西。

Normaly css is for style, so i would write custom css-file and write hover-css there.

Sorry, i do not know whether there is a command for your way - did not found anything.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文