gpt4 book ai didi

html - 悬停效果+ img上的超链接

转载 作者:行者123 更新时间:2023-11-28 13:56:57 25 4
gpt4 key购买 nike

我正在尝试将图片作为链接放置,同时对图像产生一些悬停效果。悬停效果或链接目前都不起作用。

我尝试在不同的元素上使用 :hover,我尝试使用 z-index,我尝试检查选择器的特异性,但有些东西完全停止了悬停效果,但我看不出出了什么问题。

<div class="fourthsection">
<h1>Recent Projects</h1>

<div class="projectpic-container">

<div class="picbox">
<div class= "imgBox">

<a href={{url_for('portfolio.index')}}><img src={{url_for("static", filename="neuro-ai.jpeg")}} alt="Project1"></a>

</div>
</div>

<div class="picbox">
<div class= "imgBox">
<a href={{url_for('portfolio.index')}}><img src={{url_for("static", filename="cloudtech.jpg")}} alt="Project2"></a>
</div>
</div>

<div class="picbox">
<div class= "imgBox">
<a href={{url_for('portfolio.index')}}><img src={{url_for("static", filename="statistics.jpg")}} alt="Project3"></a>

</div>
</div>

<div class="picbox">
<div class= "imgBox">
<a href={{url_for('portfolio.index')}}><img src={{url_for("static", filename="genetics.jpg")}} alt="Project4"></a>
</div>
</div>

</div>
</div>

.fourthsection{
background-color: rgb(247, 197, 164);
position: relative;
padding-top: 80px;
padding-bottom: 60px;
font-family: 'Nunito', sans-serif;
z-index: -2;
font-size: 10px;
}
.fourthsection h1{
position: absolute;
margin-left: 15%;
margin-right: 15%;
font-size: 1.8rem;
letter-spacing: 3px;
top:2%;
padding-top:1.5%;

}

.projectpic-container{
display: flex;
flex-direction: row;
justify-content: space-around;
margin-left: 13%;
margin-right: 15%;
padding-top: 45px;
width: 80vw;
height: 28 vh;

}
.projectpic-container .picbox{
position: relative;
width: 400px;
height: 250px;
margin: 8px;
}

.projectpic-container .picbox .imgBox{
position: relative;
}

.projectpic-container .picbox .imgBox img{
max-width: 100%;
border-radius: 4%;
-webkit-filter: sepia(100%);
filter: sepia(100%);
-webkit-transition: .3s ease-in-out;
transition: .3s ease-in-out;
}

.projectpic-container .picbox .imgBox:hover img{
transform: 0.3s ease-in;
-webkit-filter: sepia(0);
filter: sepia(0);
cursor: pointer;
-webkit-transform: 0.3s ease-in;
}

最佳答案

我实际上不知道你的整个页面,我不知道是否需要 z-index,但是如果你从中删除 z-index: -2

.fourthsection{
background-color: rgb(247, 197, 164);
position: relative;
padding-top: 80px;
padding-bottom: 60px;
font-family: 'Nunito', sans-serif;
z-index: -2;
font-size: 10px;
}

它工作得很好......这是片段(我显然使用了来自谷歌的图像,并在目标 _blank 中将 href 定向到谷歌)

.fourthsection{
background-color: rgb(247, 197, 164);
position: relative;
padding-top: 80px;
padding-bottom: 60px;
font-family: 'Nunito', sans-serif;
font-size: 10px;
}
.fourthsection h1{
position: absolute;
margin-left: 15%;
margin-right: 15%;
font-size: 1.8rem;
letter-spacing: 3px;
top:2%;
padding-top:1.5%;

}

.projectpic-container{
display: flex;
flex-direction: row;
justify-content: space-around;
margin-left: 13%;
margin-right: 15%;
padding-top: 45px;
width: 80vw;
height: 28 vh;

}
.projectpic-container .picbox{
position: relative;
width: 400px;
height: 250px;
margin: 8px;
}

.projectpic-container .picbox .imgBox{
position: relative;
}

.projectpic-container .picbox .imgBox img{
max-width: 100%;
border-radius: 4%;
-webkit-filter: sepia(100%);
filter: sepia(100%);
-webkit-transition: 0.3s ease-in-out;
transition: 0.3s ease-in-out;

}

.projectpic-container .picbox .imgBox:hover img{
transform: 0.3s ease-in;
-webkit-filter: sepia(0);
filter: sepia(0);
cursor: pointer;
-webkit-transform: 0.3s ease-in;
}
<div class="fourthsection">
<h1>Recent Projects</h1>

<div class="projectpic-container">

<div class="picbox">
<div class= "imgBox">

<a href="https://www.google.com" target="_blank"><img src="https://besthqwallpapers.com/Uploads/25-8-2016/3005/thumb2-remains-of-bridge-lake-park-kromelow-kromelow-lake-rakott.jpg" alt="Project1"></a>

</div>
</div>
</div>
</div>

关于html - 悬停效果+ img上的超链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58373606/

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