gpt4 book ai didi

html - 带有 z 索引的 div 中的图像

转载 作者:太空宇宙 更新时间:2023-11-04 12:44:22 25 4
gpt4 key购买 nike

这是我的代码:

<div class='f-left vignetteFamille box-sizing'>
<div class='relative contenuVignetteFamille box-sizing' style='z-index:1;'>
<br/><br/><br/><br/>
<img class='absolute' src='./charte/famille/fondBasGaucheVignetteFamille' style='bottom:-21px;left:-4px;z-index:0;'>
</div>
</div>

我想让我的 div contenuVignetteFamille 悬停在图像上,但这不起作用,我也不知道为什么

编辑:

有我的CSS,但我不知道是否对你有帮助:

.vignetteFamille{background-image:url('./charte/famille/fondVignetteFamille.png'); background-repeat:no-repeat;background-position:bottom right;margin-right:16px;width:201px;margin-top:2px;padding-bottom:19px;padding-right:19px;}
.contenuVignetteFamille{width:100%;border:solid 4px #FFC600;}

最佳答案

我不确定我是否正确理解了你的问题,但我假设你想在悬停 div contenuVignetteFamille 时突出显示图像?

这可以通过在悬停父级时向子级添加 css 来解决,如下所示:

.contenuVignetteFamille:hover img {
opacity: 0.5;
}

See my fiddle here.

另外请注意,不要使用 br 标签在您的 div 上获得一些高度,而是添加一个 height 值。我还将您的内联样式移到了外部样式。

关于html - 带有 z 索引的 div 中的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26633470/

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