我有一个上面有一个标题广告文本的图像,应该只有当悬停在图像上时才可见.标题和图像都包含一个链接,但我无法让该链接对我的图像起作用:当鼠标悬停在标题上时,链接起作用,但当鼠标悬停在图像上时,没有任何链接.我有this把小提琴.

  <article> 
<div class="entry-wrapper">
<header class="entry-header" >
            <div class="entry-meta"><span>Text</span><h2><a  href="https://www.google.com/" >Headline</a></h2>
            </header>
        <a href="https://www.google.com/" class="entry-thumbnail">
    <img width="300" height="300" src="https://images.unsplash.com/photo-1597589827317-4c6d6e0a90bd?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2080&q=80" alt="" decoding="async"></a>         
    
    <div class="entry-content entry-excerpt">
                </div>

        </div>

</article>

html *, html ::after, html ::before{
box-sizing:border-box}

.Entry-Wrapper{ 溢出:隐藏; 身高:100% }

article .entry-wrapper .entry-header{

opacity:0;
position:absolute;
z-index:15;
width:100%;
height:100%;
padding:30px;
color:white !important
}
article .entry-wrapper:hover .entry-header{
opacity:1;
transition:.3s ease-in-out;
background-color:#6C836F;
}
article .entry-wrapper{
position:relative
}
article .entry-thumbnail:hover{
opacity:1
}

.entry-小.entry-页眉,.home.entry-缩略图{ 页边距:0 } 文章.entry-wrapper.entry-Header a{ colored颜色 :白色!重要 } 第{条 宽度:300px; 高度:300px } .条目-缩略图{ 显示:块 }

<article> 
<div class="entry-wrapper">
<header class="entry-header" >
            <div class="entry-meta"><span>Text</span><h2><a href="https://www.google.com/" >Headline</a></h2>
            </header>
        <a href="https://www.google.com/" class="entry-thumbnail">
    <img width="300" height="300" src="https://images.unsplash.com/photo-1597589827317-4c6d6e0a90bd?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2080&q=80" alt="" decoding="async"></a>         
    
    <div class="entry-content entry-excerpt">
                </div>

        </div>
</article>

html *, html ::after, html ::before{
box-sizing:border-box}

.Entry-Wrapper{ 溢出:隐藏; 身高:100% }

article .entry-wrapper .entry-header{

opacity:0;
position:absolute;
z-index:15;
width:100%;
height:100%;
padding:30px;
color:white !important
}
article .entry-wrapper:hover .entry-header{
opacity:1;
transition:.3s ease-in-out;
background-color:#6C836F;
}
article .entry-wrapper{
position:relative
}
article .entry-thumbnail:hover{
opacity:1
}

.entry-小.entry-页眉,.home.entry-缩略图{ 页边距:0 } 文章.entry-wrapper.entry-Header a{ colored颜色 :白色!重要 } 第{条 宽度:300px; 高度:300px } .条目-缩略图{ 显示:块 }

推荐答案

以下是你需要的@kt7789:

click this to see the entire code

article .entry-wrapper .entry-header h2 {
  width: 100%;
  height: 100%;
}

我希望这对你有帮助!

Html相关问答推荐

将多个内联元素置于中心,而无需访问父级上的CSS

如何找到FontAwese图标的Unicode值?

使用网格时图像溢出容器高度

如何在html和css中创建动态调整大小的表元素

创建带有弯曲边框的水平时间线

按钮之间的HTML文本居中不正确

不呈现孙子元素,使用R htmlTools::Taglist为分页的pdf生成HTML

如何使不断增长的div不溢出其包含固定div的父级

获取标准的Python脚本,以便使用FASK对网站进行Flask

如何将多个类名组合到CSS中的一个关键帧

图像如何能达到 HTML 表格的全宽?

即使必填字段为空,HTML 表单也已成功提交

如何将内容放置在侧边栏旁边?

将组件移动到页面底部 Angular

Flex布局中,当父元素高度较高时,交叉轴上出现额外的空白问题.

将图像高度调整到容器 div 中而不使其高度增加

如何并排放置
的定义列表,但如果
变长,
会向下移动?

如何使用 CSS Flex 设计一个导航栏,其中一组项目左对齐而另一组项目右对齐?

需要禁用聚焦输入的工具提示(jquery)

如何让 Reindeer 居中