我有一张指向外部链接的图像,但是在我向下移动图像后,无法再单击该链接



top: 740px;代码不在时,超链接工作得很好,但一旦我向下移动图像,链接就无法再单击了。我该怎么做才能使外部链接随图像向下移动,并且仍然可以单击?

<style> 
position: relative; 
width:700px;
float: right;
height:400px;
top: 740px;     
</style> 

<div class="youtube">
<a href="https://youtube.com">
<img src="https://via.placeholder.com/150.jpeg" alt="youtube">
</a>    
</div>

我想您错过了在css 中声明类

<style>
.youtube {    /* or other class name for which you needed this css */
position: relative; 
width:700px;
float: right;
height:400px;
top: 740px;
}
</style> 

最新更新