2025-10-02

pixellated: (Default)
[personal profile] pixellated2025-10-02 05:37 pm

resizing while keeping proportions without using aspect-ratio

hi again! this is more of a general html/css question, but it has to work within dreamwidth's constraints, so i decided to ask it here. please let me know if this isn't the appropriate comm for this. i hope i used the right tags for this post.

here's what i'm trying to achieve (this would be displayed inside the most recent entry on my journal, so i can use regular CSS and not just inline, in case this matters):


i want to have a big box, and inside it a picture and a small box below that. i want the big box to resize responsively while keeping its proportions: suppose its width:height ratio is 1:2; i want it to keep that ratio always. as it resizes, i want the picture and small box inside to also resize while also keeping their proportions.

normally this would be really easy to do with aspect-ratio (<- this is a link to mozilla's developer resources) but that property doesn't seem to work on dreamwidth -- when i put it in my custom CSS, it doesn't seem to do anything, and it gets highlighted in red. (it works okay when i try it in online CSS editors, so i think it's not my mistake that's causing this.)

assuming this is true and i can't use aspect-ratio on DW, i need to cobble together some other solution, but i'm completely out of ideas. is this possible to achieve without aspect-ratio, or should i just change my idea to something that can be done on DW?

thanks again for your time!