css click on image that covered with hover overlay - html

Hello so i made a gallery with images , and i added hover overlay to it, but also added lightbox, so now when i try to click on image i am clicking on overlay. how do i make it clickable trough hover layer that i made ?
.gallery-image{
position: relative;
width: 300px;
box-shadow: rgb(139, 9, 9) 0px 5px 10px;
}
.image-img{
width: 100%;
display: block;
}
.overlay{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.6);
color: var(--tect-onblack);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
opacity: 0;
transition: all .4s ease;
}
.image-title i{
font-size: 70px;
}
.overlay:hover{
opacity: 1;
transition: all .4s ease;
cursor: pointer;
}
.overlay >*{
transform: translateY(30px);
transition: all .4s ease;
}
.overlay:hover >*{
transform: translateY(0);
}
<div class="gallery">
<div class="gallery-image">
<a href="./images/111.jpg" data-lightbox="shkaf" data-title="gal1">
<img class="image-img" src="./images/111.jpg"></a>
<div class="overlay">
<div class="image-title">
<i class='bx bx-zoom-in'></i>
</div>
</div>
<div class="price">
<p>120 000р</p>
</div>
</div>

Here's what I added/changed to achieve the desired effect (pure CSS alterations):
Moved the hover to .gallery .gallery-image and made it display: inline-block. This is so that overlay can still change, but its visual state is not tied to an event. Making it inline-block limits the hover area to the width of the content.
Added pointer-events: none to .overlay, so that mouse clicks will pass through it.
.gallery {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, auto));
gap: 2rem;
align-items: center;
justify-content: space-evenly;
max-width: 1920px;
margin: 4rem auto 0 auto;
}
.gallery-image {
position: relative;
width: 300px;
box-shadow: rgb(139, 9, 9) 0px 5px 10px;
}
.image-img {
width: 100%;
display: block;
}
.overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.6);
color: var(--tect-onblack);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
opacity: 0;
transition: all .4s ease;
pointer-events: none;
}
.image-title i {
font-size: 70px;
}
.gallery-image:hover .overlay {
opacity: 1;
transition: all .4s ease;
cursor: pointer;
}
.overlay>* {
transform: translateY(30px);
transition: all .4s ease;
}
.overlay:hover>* {
transform: translateY(0);
}
<div class="gallery">
<div class="gallery-image">
<a href="./images/111.jpg" data-lightbox="shkaf" data-title="gal1">
<img class="image-img" src="./images/111.jpg"></a>
<div class="overlay">
<div class="image-title">
<i class='bx bx-zoom-in'></i>
</div>
</div>
<div class="price">
<p>120 000р</p>
</div>
</div>
</div>

I used the current clicked class to create a click event.
let imgs = document.querySelectorAll('.overlay');
imgs.forEach((img) => {
img.addEventListener("click", () => {
console.log("Image was clicked");
});
});
.gallery-image {
position: relative;
width: 300px;
box-shadow: rgb(139, 9, 9) 0px 5px 10px;
}
.image-img {
width: 100%;
display: block;
}
.overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.6);
color: var(--tect-onblack);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
opacity: 0;
transition: all .4s ease;
}
.image-title i {
font-size: 70px;
}
.overlay:hover {
opacity: 1;
transition: all .4s ease;
cursor: pointer;
}
.overlay>* {
transform: translateY(30px);
transition: all .4s ease;
}
.overlay:hover>* {
transform: translateY(0);
}
<div class="gallery">
<div class="gallery-image">
<a href="./images/111.jpg" data-lightbox="shkaf" data-title="gal1">
<img class="image-img" src="./images/111.jpg"></a>
<div class="overlay">
<div class="image-title">
<i class='bx bx-zoom-in'></i>
</div>
</div>
<div class="price">
<p>120 000р</p>
</div>
</div>

Related

Is it possible to add a hover effect on the pseudo element "after" itself?

I know I can add a hover effect on the real element that could, potentially, change the after pseudo element, but I need the after pseudo-element background to change when I hover on the after pseudo-element itself.
This is my card, and I would like that when I hover on the "check it out" pseudo-element, its background would change and get a shadow. I don't know if it's possible though because this line of CSS seems to have no effect:
.card::after:hover {
filter: drop-shadow(30px 10px 4px #4444dd);
background-color: red;
}
.card {
--fs-card: 1.2rem;
background-color: var(--clr-light);
width: 200px;
height: 90%;
max-height: 31.25rem;
display: flex;
flex-direction: column;
align-items: center;
border-radius: 5px;
box-shadow: 3px 3px 8px rgb(0, 0, 0);
overflow: hidden;
justify-content: space-between;
position: relative;
cursor: pointer;
transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
}
.card:hover {
transform: scale(1.05);
}
.card::after {
opacity: 0;
content: "Check it out";
font-family: "Myriad pro";
font-size: 1.2rem;
position: absolute;
z-index: 3;
left: 3px;
top: 3px;
background-color: #0c44ddd2;
color: var(--clr-light);
border-radius: var(--btn-border-radius);
padding: 0.1rem 0.6rem;
transition: all 0.5s cubic-bezier(0.215, 0.61, 0.355, 1);
}
.card:hover::after {
opacity: 1;
}
.card::after:hover {
filter: drop-shadow(30px 10px 4px #4444dd);
background-color: red;
}
.article-img-container {
height: 60%;
width: 100%;
background-color: white;
}
.article-img {
object-fit: contain;
object-position: center;
height: 100%;
width: 100%;
}
<div class="card">
<div class="article-img-container">
<img
class="article-img"
src="https://files.refurbed.com/ii/apple-watch-series-6-alu-40mm-1613627678.jpg?t=resize&h=600&w=800"
alt=""
/>
</div>
<div class="article-info-container">
<p class="article-title">Smart Watch S6</p>
<p class="article-price clr-primary">€ 266.99</p>
</div>
<button class="btn btn-card">ORDER NOW</button>
</div>
From what I know, I don't think it's possible this way: after is a pseudo element, pseudo means, not a real DOM element.
What I would suggest is using you already have relative, absolute positioning in your element. Make your check it out a real element absolute position, and a css on hover on card which acts on check it out
.card {
--fs-card: 1.2rem;
background-color: var(--clr-light);
width: 200px;
height: 90%;
max-height: 31.25rem;
display: flex;
flex-direction: column;
align-items: center;
border-radius: 5px;
box-shadow: 3px 3px 8px rgb(0, 0, 0);
overflow: hidden;
justify-content: space-between;
position: relative;
cursor: pointer;
transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
}
.card:hover {
transform: scale(1.05);
}
.card-checkout {
opacity: 0;
font-family: "Myriad pro";
font-size: 1.2rem;
position: absolute;
z-index: 3;
left: 3px;
top: 3px;
background-color: #0c44ddd2;
color: var(--clr-light);
border-radius: var(--btn-border-radius);
padding: 0.1rem 0.6rem;
transition: all 0.5s cubic-bezier(0.215, 0.61, 0.355, 1);
}
.card:hover .card-checkout {
opacity: 1;
}
.article-img-container {
height: 60%;
width: 100%;
background-color: white;
}
.article-img {
object-fit: contain;
object-position: center;
height: 100%;
width: 100%;
}
.card-checkout:hover {
filter: drop-shadow(30px 10px 4px #4444dd);
background-color: red;
}
<div class="card">
<div class="article-img-container">
<img class="article-img" src="https://files.refurbed.com/ii/apple-watch-series-6-alu-40mm-1613627678.jpg?t=resize&h=600&w=800" alt="" />
</div>
<div class="article-info-container">
<p class="article-title">Smart Watch S6</p>
<p class="article-price clr-primary">€ 266.99</p>
</div>
<button class="btn btn-card">ORDER NOW</button>
<div class="card-checkout">
Check it out
</div>
</div>

Why the images in the background are glow up when I click?

When I click my <a> tag for the popup box, the images in the background (with overlay effects) are glowing up, and I don't know why. If anybody know something I write the code under here.
As you can see I've put href to #popup1 in the first <a> tag, and it opens the popup box, but in the background you can see the image like glowing, the border too.
I've changed the display tag and other CSS tags, but nothing.
Here is the Codepen.
the problem is actually you add pop-up before container 2 so that's why it is glowing.
So, if you dont want to make this glow just add your pop-up division after both
containers like this.
Dont change your Css. you just have to change position of divisions like this
<div class="container1" style="cursor:default;">
<div class="container2">
<div class="content">
<a id="ant" href="#popup1" onclick="show('popup2')">
<div class="content-overlay"></div>
<img class="content-image" src="https://i.postimg.cc/5tNkjkV5/2.png" style="z-index: 0;height: 200px;width: 330px;border:2px solid rgb(205,144,76);padding:0;">
<div class="content-details fadeIn-bottom" style="background-size:cover;">
<h3 class="content-title" style="font-family: 'Roboto', sans-serif;">ANTIPASTI</h3>
<p class="content-text"></p>
</div>
</a>
</div>
</div>
<div class="container2">
<div class="content">
<a id="prim">
<div class="content-overlay"></div>
<img class="content-image" src="https://i.postimg.cc/5tNkjkV5/2.png" style="border:2px solid rgb(205,144,76);padding:0; height:200px; width:330px;">
<div class="content-details fadeIn-bottom">
<h3 class="content-title" style="font-family: 'Roboto', sans-serif;"> PRIMI PIATTI </h3>
<p class="content-text"></p>
</div>
</a>
</div>
</div>
</div>
<div id="popup1" class="popup">
×
<h2>The Popup Has Arrived</h2>
<p>QUESTI SONO GLI ANTIPASTI</p>
</div>
<a href="#ant" class="close-popup"></a
It depends on the order of your HTML-Elements. This example will fix the problem
.container1 {
display: flex;
width: 100%;
flex-wrap: wrap;
margin-top: 110px;
align-content: space-around;
justify-content: center;
transition: all 0.2s linear;
}
.container1 > div {
padding: 40px;
justify-content: center;
}
*,
*:before,
*:after {
margin: 0;
padding: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.main-title {
color: #2d2d2d;
text-align: center;
text-transform: capitalize;
padding: 0.7em 0;
}
.container {
padding: 1em 0;
float: left;
width: 50%;
}
#media screen and (max-width: 640px) {
.container {
display: block;
width: 100%;
}
}
#media screen and (min-width: 900px) {
.container {
width: 33.33333%;
}
}
.container .title {
color: #1a1a1a;
font-family: 'Roboto', sans-serif;
text-align: center;
margin-bottom: 10px;
}
.content {
position: relative;
width: 100%;
max-width: 400px;
height: 100%;
margin: auto;
overflow: hidden;
transition: transform 0.4s;
}
.content .content-overlay {
/* background: rgba(70,34,0);*/
background: rgba(214, 142, 60, 70%);
/* background: rgb(214,142,60);*/
position: absolute;
height: 97%;
width: 100%;
left: 30px;
top: 0;
bottom: 0;
right: 0;
opacity: 0;
-webkit-transition: all 0.4s ease-in-out 0s;
-moz-transition: all 0.4s ease-in-out 0s;
transition: all 0.4s ease-in-out 0s;
}
.content:hover .content-overlay {
opacity: 0.5;
}
.content-details {
position: absolute;
text-align: center;
padding-left: 1em;
padding-right: 1em;
width: 100%;
top: 50%;
left: 50%;
opacity: 0;
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
-webkit-transition: all 0.3s ease-in-out 0s;
-moz-transition: all 0.3s ease-in-out 0s;
transition: all 0.3s ease-in-out 0s;
}
.content:hover .content-details {
top: 50%;
left: 50%;
right: 50%;
opacity: 1;
}
.content-details h3 {
color: #fff;
font-weight: 500;
text-align: center;
letter-spacing: 0.15em;
margin-bottom: 0.5em;
padding-left: 20px;
text-transform: uppercase;
}
.content-details p {
color: #fff;
font-size: 0.8em;
text-align: center;
padding-left: 20px;
}
.fadeIn-bottom {
top: 80%;
}
.fadeIn-top {
top: 20%;
}
.fadeIn-left {
left: 20%;
}
.fadeIn-right {
left: 80%;
}
h1 {
font-size: 3em;
text-align: center;
color: #00898e;
margin: 0;
padding: 30vh 0 1em;
}
h2 {
text-align: center;
white-space: nowrap;
color: #00898e;
}
a {
text-decoration: none;
color: #fff;
}
p {
text-align: left;
}
.btn {
display: inline-block;
padding: 10px 20px;
border: 2px solid #00898e;
border-radius: 10px;
transition: background 0.3s;
}
.btn:hover {
background: #00898e;
}
.popup {
position: fixed;
padding: 10px;
max-width: 500px;
border-radius: 10px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: rgba(255, 255, 255, 0.9);
visibility: hidden;
opacity: 0;
/* "delay" the visibility transition */
-webkit-transition: opacity 0.5s, visibility 0s linear 0.5s;
transition: opacity 0.5s, visibility 0s linear 0.5s;
z-index: 1;
}
.popup:target {
visibility: visible;
opacity: 1;
/* cancel visibility transition delay */
-webkit-transition-delay: 0s;
transition-delay: 0s;
}
.popup-close {
position: absolute;
padding: 10px;
max-width: 500px;
border-radius: 10px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: rgba(255, 255, 255, 0.9);
}
.popup .close {
position: absolute;
right: 5px;
top: 5px;
padding: 5px;
color: #000;
transition: color 0.3s;
font-size: 2em;
line-height: 0.6em;
font-weight: bold;
}
.popup .close:hover {
color: #00e5ee;
}
.close-popup {
background: rgba(0, 0, 0, 0.7);
cursor: default;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
opacity: 0;
visibility: hidden;
/* "delay" the visibility transition */
-webkit-transition: opacity 0.5s, visibility 0s linear 0.5s;
transition: opacity 0.5s, visibility 0s linear 0.5s;
}
.popup:target + .close-popup {
opacity: 1;
visibility: visible;
/* cancel visibility transition delay */
-webkit-transition-delay: 0s;
transition-delay: 0s;
}
<div class="container1" style="cursor: default">
<div class="container2">
<div class="content">
<a id="ant" href="#popup1" onclick="show('popup2')">
<div class="content-overlay"></div>
<img
class="content-image"
src="https://i.postimg.cc/5tNkjkV5/2.png"
style="z-index: 0; height: 200px; width: 330px; border: 2px solid rgb(205, 144, 76); padding: 0"
/>
<div class="content-details fadeIn-bottom" style="background-size: cover">
<h3 class="content-title" style="font-family: 'Roboto', sans-serif">ANTIPASTI</h3>
<p class="content-text"></p>
</div>
</a>
</div>
</div>
<div class="container2">
<div class="content">
<a id="prim">
<div class="content-overlay"></div>
<img
class="content-image"
src="https://i.postimg.cc/5tNkjkV5/2.png"
style="border: 2px solid rgb(205, 144, 76); padding: 0; height: 200px; width: 330px"
/>
<div class="content-details fadeIn-bottom">
<h3 class="content-title" style="font-family: 'Roboto', sans-serif">PRIMI PIATTI</h3>
<p class="content-text"></p>
</div>
</a>
</div>
</div>
<!-- The popup should be entered as the last element so that it overlays the other elements -->
<div id="popup1" class="popup">
×
<h2>The Popup Has Arrived</h2>
<p>QUESTI SONO GLI ANTIPASTI</p>
</div>
</div>

how to keep the hover background after the user moved the mouse until the transform finishes

I got a div that changes its background to an image when a user hovers over it. The background is doing fine when the user hovers over it and the transform effect is applied smoothly, but when the user removes the mouse the image disappears suddenly.
I don't want it to happen and want the image to have a zoom out effect just like the Text inside the div and once the effect is finished the background changes to the default one and do not disappear suddenly without any effects.
How can I make it possible?
Here's my div:
html,
body {
margin: 0px;
padding: 0px;
}
.wrapper {
max-width: 1200px;
text-align: center;
margin-left: auto;
margin-right: auto;
}
.container {
width: 45%;
margin: 20px;
height: 300px;
border: 3px solid #eee;
overflow: hidden;
position: relative;
display: inline-block;
cursor: pointer;
}
.child {
height: 100%;
width: 100%;
background-size: cover;
background-repeat: no-repeat;
-webkit-transition: all .5s;
-moz-transition: all .5s;
-o-transition: all .5s;
transition: all .5s;
background-color: darkgray;
}
span {
display: block;
font-size: 35px;
color: #ffffff !important;
font-family: sans-serif;
text-align: center;
margin: auto;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
height: 50px;
cursor: pointer;
text-decoration: none;
}
.container:hover .child,
.container:focus .child {
background-image: url(https://images.freeimages.com/images/large-previews/de7/energy-1-1176465.jpg);
-ms-transform: scale(1.2);
-moz-transform: scale(1.2);
-webkit-transform: scale(1.2);
-o-transform: scale(1.2);
transform: scale(1.2);
}
.container:hover .child:before,
.container:focus .child:before {
display: block;
}
.child:before {
content: "";
display: none;
height: 100%;
width: 100%;
position: absolute;
top: 0;
left: 0;
background-color: rgba(52, 73, 94, 0.75);
}
<div class="wrapper">
<div class="container">
<div class="child">
<span>Text</span>
</div>
</div>
</div>
Here's some simplified CSS using display: grid and putting the images in the HTML
The image has opacity: 0 to begin with, once hovered it goes to opacity: 0.75
The image is the item that increases size on hover, this is so the text doesn't clip
Change the hover accent by adding style="--colorHover: red" to any .container
The gap between items is larger on bigger screens
Plus your browser will love you because the properties that change on hover won't trigger layout, and other than background-color it won't trigger paint! See here for more details https://csstriggers.com
* { box-sizing: border-box } body { font: 16px sans-serif; margin: 0 }
:root {
--bgImg: url('https://images.freeimages.com/images/large-previews/de7/energy-1-1176465.jpg');
--colorDefault: darkgray;
--colorHover: black;
--columnWidth: 1;
--transTime: 660ms;
--transFunc: cubic-bezier(0.77, 0, 0.175, 1);
--wrapperGap: 1rem;
}
#media (min-width: 768px) { :root { --wrapperGap: 1.5rem } }
#media (min-width: 1200px) { :root { --wrapperGap: 2rem } }
.wrapper {
display: flex;
flex-wrap: wrap;
gap: var(--wrapperGap);
justify-content: center;
margin: auto;
max-width: 1200px;
padding: var(--wrapperGap);
text-align: center;
}
.container {
border: 3px solid #eee;
cursor: pointer;
flex: 0 0 auto;
width: calc( ( var(--columnWidth) * 50% ) - ( var(--wrapperGap) / 2 ) ) ;
overflow: hidden;
}
.child {
background-color: var(--colorDefault);
display: grid;
height: 100%; width: 100%;
place-items: center;
transition: background-color var(--transTime) var(--transFunc);
}
.child > * { grid-area: 1/1/-1/-1 }
.child .txt {
color: #ffffff;
cursor: pointer;
font-size: 35px;
text-align: center;
z-index: 1;
}
.child .img {
aspect-ratio: var(--columnWidth)/1;
background-image: var(--bgImg);
background-size: cover;
opacity: 0;
width: 100%;
transition: opacity calc(var(--transTime) * 2) var(--transFunc), transform var(--transTime) var(--transFunc);
}
.container:hover .child {
background-color: var(--colorHover);
transition: background-color var(--transTime) calc(var(--transTime) / 2) var(--transFunc);
}
.container:hover .child .img {
opacity: 0.75;
transform: scale(1.2);
transition: opacity var(--transTime) var(--transFunc), transform calc(var(--transTime) * 2) var(--transFunc);
}
<div class="wrapper">
<div class="container">
<div class="child">
<div class="img"></div>
<div class="txt">Original Image</div>
</div>
</div>
<div class="container" style="--colorHover: green; --bgImg: url('https://picsum.photos/600?random=1');">
<div class="child">
<div class="img"></div>
<div class="txt">Random One</div>
</div>
</div>
<div class="container" style="--colorHover: blue; --bgImg: url('https://picsum.photos/600?random=2');">
<div class="child">
<div class="img"></div>
<div class="txt">Random Two</div>
</div>
</div>
<div class="container" style="--colorHover: red; --bgImg: url('https://picsum.photos/600?random=3');">
<div class="child">
<div class="img"></div>
<div class="txt">Random Three</div>
</div>
</div>
<div class="container" style="--columnWidth: 2; --colorHover: purple; --colorDefault: pink; --bgImg: url('https://picsum.photos/600?random=4');">
<div class="child">
<div class="img"></div>
<div class="txt">Random Four (large)</div>
</div>
</div>
</div>

Possibility to change a font awesome icon with transition

No, I have no code to demonstrate but I have been wondering: Is it possible to change a font-awesome logo with just transition? Such as: Change the class? I did a little bit of research on w3schools and How can create transition effect in font awesome icon found this link aswell, but they didn't really help and this question has been with me for a long time.
so, the question is: Is it possible to make a logo change (font awesome) with css transition or do I need javascript for it?
in case the question shouldn't be posted here. please tell me where it should so I can move it.
Cheers,
Here you go:
This has been done here: https://codepen.io/toaster99/pen/BpgzQR
HTML:
<div id="container">
<div class="button">
<div class="icons">
<i class="fa fa-apple icon-default"></i>
<i class="fa fa-arrow-circle-down icon-hover"></i>
</div>
Download
</div>
</div>
CSS:
#attribution {
position: fixed;
right: 10px;
bottom: 10px;
color: #FE8989;
z-index: 100;
font-weight: bold;
cursor: pointer;
a {
color: inherit;
text-decoration: inherit;
}
}
#container {
background: linear-gradient(#8affff,#80eded);
position: relative;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
position: relative;
}
.button {
position: relative;
margin-bottom: 40px;
display: inline-flex;
justify-content: center;
align-items: center;
background: #FE8989;
box-shadow: 0px 0px 0 0px rgba(0,0,0,0);
border-radius: 50px;
width: 25.25rem;
padding: 1rem 0;
font-family: 'Montserrat', sans-serif;
font-weight: 600;
font-size: 2.75rem;
color: white;
cursor: pointer;
-moz-transition: all 0.3s ease;
transition: all 0.3s ease;
.icons {
position: relative;
display: flex;
justify-content: center;
align-items: center;
margin: 0 2.3rem 0 0;
width: 1.25rem;
height: 2.6rem;
i {
position: absolute;
top: 0;
left: 0;
display: block;
}
.icon-default {
transition: opacity .3s, transform .3s;
}
.icon-hover {
transition: opacity .3s, transform .3s;
transform: rotate(-180deg) scale(.5);
opacity: 0;
}
}
&:hover {
transform: scale(1.2);
box-shadow: 20px 15px rgba(0,0,0,0.15);
.icon-hover {
transform: rotate(0deg) scale(1);
opacity: 1;
}
.icon-default {
transform: rotate(180deg) scale(.5);
opacity: 0;
}
}
}
yes, its pretty simple after you see the solution but I was confused too which led me to this post.
css
#keyframes pulse {
0% {
color:transparent;
}
50% {
color: #065803;
}
75% {
color:rgb(113, 139, 0);
}
100% {
color: #065803;
}
0% {
color:rgb(189, 176, 1);
}
}
#linked{
font-size: 16.5rem;
color: white;
display: flex;
justify-content: center;
}
i{
animation: pulse 8s infinite ease;
} ```
HTML
<i id="linked" class="fab fa-linkedin"></i>
</a>
</div>
<div class="col-2-of-2">
<a href="projects.html" target="_blank">
<i id="linked" class="fas fa-code"></i>
</a>
```

divider not showing with onhover effects

I am just attempting a simple fix. For some reason my divider isn't showing up on hover? How can I get it to show up like the other text does? I have another example of how i got the divider to look on other pages...
http://runningfish.net/finestc/about/
Right underneath the header of the page that says "About"
Also, what I am currently working with is runningfish.net/finestc
You can see the live code there right underneath the section that says "Recent Sales".
I am still a fledgling coder so if I am doing something inefficiently or could be doing better that you notice, please point it out! I want to get better at coding. Critique welcome!
Thanks!
.grids {
width: 33.33%;
float: left;
display: inline-block;
position: relative;
}
.grids img {
display: block;
height: 33.33vh;
width: 100%;
}
.grid-image-description {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.6);
color: #fff;
visibility: hidden;
opacity: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
transition: opacity .5s, visibility .5s;
}
.grid-image-description h2 {
font-family: playfairdisplay;
font-size: 1.7em;
color: #fff;
}
.grid-image-description p {
font-family: playfairdisplay;
font-size: 1.0em;
color: #fff;
}
.grid-image-description hr {
border-top: 1px;
border-color: #001532;
border-style: solid;
box-shadow: 2px 1px 15px #fff;
margin: 0 0 0 10px;
max-width: 200px;
}
.grids:hover .grid-image-description {
visibility: visible;
opacity: 1;
}
.grids-description {
transition: .5s;
transform: translateY(1em);
}
.grids:hover .grid-image-description {
transform: translateY(0);
}
<a href="#nogo">
<div class="grids">
<img class="grid-image-cover" alt="" src="//runningfish.net/finestc/wp-content/uploads/2018/02/Depositphotos_11636543_original.jpg" />
<div class="grid-image-description">
<h2 class="grids-header">House For Sale</h2>
<hr>
<p class="grids-description">123 mulbury street</br>san diego, ca 92101
</p>
</div>
</div>
</a>
Add a width value to <hr>
.grids {
width: 33.33%;
float: left;
display: inline-block;
position: relative;
}
.grids img {
display: block;
height: 33.33vh;
width: 100%;
}
.grid-image-description {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.6);
color: #fff;
visibility: hidden;
opacity: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
transition: opacity .5s, visibility .5s;
}
.grid-image-description h2 {
font-family: playfairdisplay;
font-size: 1.7em;
color: #fff;
}
.grid-image-description p {
font-family: playfairdisplay;
font-size: 1.0em;
color: #fff;
}
.grid-image-description hr {
border-top: 1px;
border-color: #001532;
border-style: solid;
box-shadow: 2px 1px 15px #fff;
margin: 0 0 0 10px;
max-width: 200px;
/* added */
width: 200px;
}
.grids:hover .grid-image-description {
visibility: visible;
opacity: 1;
}
.grids-description {
transition: .5s;
transform: translateY(1em);
}
.grids:hover .grid-image-description {
transform: translateY(0);
}
<a href="#nogo">
<div class="grids">
<img class="grid-image-cover" alt="" src="//runningfish.net/finestc/wp-content/uploads/2018/02/Depositphotos_11636543_original.jpg" />
<div class="grid-image-description">
<h2 class="grids-header">House For Sale</h2>
<hr>
<p class="grids-description">123 mulbury street<br>san diego, ca 92101
</p>
</div>
</div>
</a>