So I need to have this image with a ratio lets say 2880x1520 on 100vh.
I can do that using object-fit:cover; object-position: center left;
It works fine.
The problem is that I also have to place buttons on specific parts of the image and the image is of course resizing depending on the browser ratio.
So I'm having a hard time to figure out what would be the rules for the button to follow the image resizing that object-fit:cover implies, so the button would be always on top of that specific image part and follow the image resize.
It's probably a combination of vh and vw but I can't really figure out what would be the exact rule here.
Thanks in advance for you ideas!
Instead of doing this, I would set the image as the background of the div and then use flexbox to position the button.
HTML
CSS
The method you want to do it with is also possible like this. Setting position absolute to the image and the button and then use flexbox to position the button to the middle.
HTML
CSS
If you do not want the button to be on the middle, which is not quite clear from your post, you can use different flex alignment options and then left: vw; (viewport-width) or top: vh; (viewport-height) to further align your button.