I have an HTML element with a background image and want to create a mirror effect to the bottom, as if the image is reflected like this:
The optimal solution for me to create this reflection would be CSS only without using more elements than this single one and without using the image URL multiple times (due to maintenance reasons). I only found solutions like this with "complicated" HTML markup.
This is my code:
div {
position: relative;
background: url(https://i.stack.imgur.com/P56gr.jpg);
width: 300px;
height: 200px;
}
div:after {
content: "";
position: absolute;
background: url(https://i.stack.imgur.com/P56gr.jpg);
display: block;
width: 300px;
height: 200px;
bottom: -210px;
}
<div></div>