Looking for a hover effect on the project section of the portfolio.
The layout is created using CSS Grid, and upon hovering, a responsive link to view the Live Demo should appear with animation transition.
Attempted to implement the hover effect but it ended up affecting the layout negatively.
The requirement is to use only CSS hover animations without any Javascript.
The hover effect needs to display the link smoothly.
@DylanScript provided a solution, but it's not functioning properly. Refer to the attached image. https://i.sstatic.net/emwN3.jpg
Here is a second image for reference: https://i.sstatic.net/9gI1L.jpg
* {
box-sizing: border-box;
}
body {
height: 100%;
margin: 0;
line-height: 1.5;
}
a {
color: #fff;
text-decoration: none;
}
.projects {
display: grid;
grid-gap: 0.7rem;
grid-template-columns: repeat(3, 1fr);
}
.projects img {
width: 100%;
border: 3px #fff solid;
}
.projects img:hover {
opacity: 0.5;
}
.infobar {
cursor: default;
font-size: 0.9rem;
font-weight: lighter;
padding: 10px;
text-align: left;
width: 100%;
height: 30%;
position: absolute;
bottom: -30%;
transition: .3s ease-in-out;
background: #413a44;
}
.infobar p {
opacity: 0;
margin: 0;
transition: .6s ease-in-out;
}
.item:hover .infobar {
bottom: 0%;
}
.viewBar:hover p {
opacity: 1;
}
.viewBar img {
position: absolute;
left: 0;
bottom: 0%;
transition: .32s ease-in-out;
}
.viewBar:hover img {
bottom: 30%;
}
.item:hover {
transform: scale(1.01);
filter: grayscale(0.6);
}
@media screen and (min-width: 1171px) {
.projects {
grid-template-columns: repeat(4, 1fr);
}
}
@media screen and (min-width: 769px) and (max-width: 1170px) {
.projects {
grid-template-columns: repeat(3, 1fr);
}
}
<nav>
</nav>
<main>
<div class="projects">
<div class="item viewBar">
<a href="#">
<img src="https://source.unsplash.com/1600x899/?water">
</a>
<div class="infobar">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit.
<a href="#" class="btn-light">
Demo...
</a>
</p>
</div>
</div>
<div class="item viewBar">
<a href="#">
<img src="https://source.unsplash.com/1600x899/?water">
</a>
<div class="infobar">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit.
<a href="#" class="btn-light">
Demo...
</a>
</p>
</div>
</div>
<div class="item viewBar">
<a href="#">
<img src="https://source.unsplash.com/1600x899/?water">
</a>
<div class="infobar">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit.
<a href="#" class="btn-light">
Demo...
</a>
</p>
</div>
</div>
</div>
</main>
<footer>
</footer>