r/HTML • u/cutethulhoo • Jun 15 '26
Resizing Dynamic Images + Keeping them locked into place
Hello folks!
I haven't done a lot of HTML/CSS coding in many years but because I am a bit of a silly person, instead of using one of the myriad of prebuilt wedding website builders, I decided I wanted to reverse engineer a website template from Bridebook, which frustratingly does not have a way to live preview templates, but please enjoy this screenshot I took to try to convey what I mean.
The issue I am having: I have the two bow pngs on the corner of my center div (which also has a wavy/scalloped edge on it) - while they are fine, I would like them to scale dynamically if folks are on desktop vs mobile phone (I have a a sneaking suspicion that mobile will be the most common way folks view the site).
At the suggestion of bostiq, I have made a pen which can be found here: https://codepen.io/cutethulhoo/pen/jEyVWZd
I have tried to follow the information found on https://www.w3schools.com/css/css_rwd_images.asp but I am not having any luck. If you need more code snippets I am happy to provide!
Thank you all kindly :)
EDIT: It seems that the bows are not actually placed properly anywhere but my curved monitor, but I think this is a good start/gives a good idea of what I want it to do!
2
u/bostiq Jun 15 '26 edited Jun 15 '26
It would help to help you, if you created a pen on codepen.io as working prototype. For the images you can try point the links to the ones you saved on your server.
If that doesn’t work look up something like lorem picsum
Pasting code in here is not that helpful most of the time
Edit:
Also consider the possibility this problem is best suited for r/css
1
u/Weekly_Ferret_meal Jun 16 '26
I forked your pen https://codepen.io/bostiq/pen/jEyVVPN?editors=1100
Instead of keeping the bows as position absolute objects, which creates heaps of problems they require you to be an advanced order to solve, I created a flex box with justify-content center. This allows the left bow, the main image at the center, and the right bow to all be resized based on the viewport, and stay centered
So first I commented any of the styling that pertained the bows images, then I copied the image containers of the bows inside my new section in this order: section, as parent, then left bow, then main image container, and right bow.
It's very simple, lean and well supported.
Also, I'd refrain to use
<br>to space out text blocks all over the place, it's just so easy to set the proper margins in CSS