Is there a way to make an image appear in a different location on the page when it's hovered over? I've searched online but couldn't find a solution using just HTML and CSS. Does anyone know how to achieve this effect?
Image not hovered: https://i.stack.imgur.com/GweOk.png
Image hovered: https://i.stack.imgur.com/6cRjK.png
I attempted to create a transparent duplicate of the image placed in a defined grid area, but it wouldn't sit on top of the text.
HTML code:
<section id="fav-place" class="place-sec">
<article class="place-art">
<div class="place-desc">
<h1>A place I Enjoyed visiting</h1>
<h2 class="sec-h2">Cape Greco, Cyprus</h2>
<p>Cape Greco is cape and also a small peninsula in the southeast of Cyprus, in Famagusta, between Ayia Napa and Paralimni.
According to the findings of the excavations that took place in 1992, this site is considered to be one of the most ancient settlements on the island
</p>
<p>
In the sea area of Cape Greco there are submarine ravines and caves that are popular for diving.
Within sea ravines up to 10 meters high, there are sea caves, which are called "palaces".
These caves, along with Smugglers caves, are accessible only by the sea.
</p>
</div>
<div class="why-i-like-place">
<h2>Why I like this place</h2>
<p>Because of the clear water, the cliffs around, and the beautiful sights</p>
</div>
</article>
<aside class="place-aside">
<img class="p-sm-img first-last-img" src="/images/cape-greco-imgs/boat.jpg" alt="boat-img">
<img class="p-sm-img" src="/images/cape-greco-imgs/bridge.jpg" alt="bridge-img">
<img class="p-sm-img" src="/images/cape-greco-imgs/cave.jpg" alt="cave-img">
<img class="p-sm-img" src="/images/cape-greco-imgs/hole.jpg" alt="hole-img">
<img class="p-sm-img" src="/images/cape-greco-imgs/sm cliff.jpg" alt="sm-cliff-img">
<img class="p-sm-img" src="/images/cape-greco-imgs/sunrise.jpg" alt="sunrise-img">
<img class="p-sm-img first-last-img" src="/images/cape-greco-imgs/tree.jpg" alt="tree-img">
</aside>
</section>
CSS code:
.place-art {
grid-column: 1/2;
display: grid;
grid-template-rows: 3fr 1fr;
}
.place-desc-sec{
grid-row: 1/-2;
}
.place-aside {
border: solid 0.5vh;
border-color: rgba(185, 218, 100, 0.862);
border-radius: 1vh;
margin-top: 6vh;
overflow-y: scroll;
display: flex;
flex-direction: column;
}
.place-sec {
display: grid;
grid-template-columns: 2fr 1fr;
}
.first-last-img {
margin: 0;
}
.p-sm-img {
margin: 0.2vh 0;
width: 23.5vw;
}
.p-sm-img:hover {
}
.p-lrg-img {
visibility: hidden;
opacity: 0.2;
grid-row: 1/-2;
grid-column: 1/2;
}
.why-i-like-place {
grid-row: 2/3;
grid-column: 1/2
}