I'm currently working on a basic web page project to practice my HTML and CSS skills. I have added a hover pseudo class for the croissant image, but when I hover over it, the coffee cup image unexpectedly shifts to the right by around 50 to 100 pixels. Once I move the cursor away from the croissant, the coffee cup returns to its original position. I am relatively new to web design and only started learning a few days ago. Here is the code snippet:
body {
margin: 0px;
background-image: url('https://c8.alamy.com/comp/2BT68F1/vector-black-chalkboard-style-hand-drawn-bakery-horizontal-border-pattern-suitable-for-bread-packaging-cafe-menu-design-and-wallpaper-2BT68F1.jpg');
background-size: cover;
}
#img1 {
background-repeat: no-repeat;
width: 100%;
height: 40%;
}
#instagram1 {
width: 20px;
height: 20px;
float: left;
}
#instagram2 {
width: 20px;
height: 20px;
position: relative;
right: 168px;
top: 5px;
}
#bakery {
color: black;
float: left;
position: relative;
bottom: 15px;
left: 5px;
}
#cafe {
color: black;
float: left;
position: relative;
right: 75px;
bottom: 10px;
}
div {
width: 200px;
height: 60px;
float: right;
position: relative;
top: 550px;
background-color: #b3d9ff;
}
#croissant {
width: 200px;
height: 100px;
position: relative;
left: 1100px;
top: 250px;
}
#espresso {
position: relative;
top: 280px;
right: 150px;
width: 200px;
height: 150px;
}
#croissant:hover {
width: 250px;
height: 150px;
}
<img id="croissant" src="https://freepngimg.com/thumb/croissant/29021-7-croissant-transparent-background.png">
<img id="espresso" src="https://services.garmin.com/appsLibraryBusinessServices_v0/rest/apps/eae8653c-e809-4e35-ac17-d9866ba92b26/icon/e684d982-4aa3-48fb-8e2e-08d53e5096b6">
<div>
<img id="instagram1" src="https://upload.wikimedia.org/wikipedia/commons/thumb/e/e7/Instagram_logo_2016.svg/768px-Instagram_logo_2016.svg.png">
<p id="bakery"> @red.bakery </p>
</br>
</br>
<img id="instagram2" src="https://upload.wikimedia.org/wikipedia/commons/thumb/e/e7/Instagram_logo_2016.svg/768px-Instagram_logo_2016.svg.png">
<p id="cafe"> @red.cafe </p>
</div>