gpt4 book ai didi

php - 使用 :hover for an element's inline style (using HTML/CSS/php)

转载 作者:太空狗 更新时间:2023-10-29 15:47:28 28 4
gpt4 key购买 nike

<分区>

Possible Duplicates:
How do I embed an “a:hover{…}” rule into a style attribute in the middle of a document?
How to write a:hover in inline CSS?

我想动态更改元素的悬停颜色,但不使用外部 CSS 样式表,只能内联。这是代码(使用 php 生成元素)

echo '
<div class="container" style="color:#'.$color.'">
'.$contents.'
</div>';

当用户将鼠标悬停在该容器元素上时,颜色样式将更改为$color 的值(此时没有悬停)。

如有任何帮助,我们将不胜感激。

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com