I want to have a dot pattern that overlays an image, but I need it to be transparent on the right side and I need it to become opaque/visible to the left side - like using a gradient to reveal the pattern.
<html>
<head>
<style>
.image-container {
display: block;
background: url(https://cdn.getyourguide.com/img/location_img-59-1969619245-148.jpg) no-repeat;
background-size: cover;
height: 400px;
width: 837px;
}
.dot-overlay {
background: url(square-pattern.svg);
width: 100%;
height: 400px;
}
</style>
</head>
<body>
<div class="image-container">
<img class="dot-overlay">
</div>
</body>
</html>
The Result
This is the result I want to achieve
EDIT: Apologies, I forgot to mention that I needed this solution to be responsive (even though the image in my example is fixed size) and preferably I'd also like the pattern dots to remain the same size when the image is resized.
Thankfully, Temani Afif solution manages this and gives control over the gradient too! Also, to make the dots more square change percentages to 50% each e.g. radial-gradient(farthest-side,blue 50%,transparent 50%)