« Web, HTML, Tech Forum

how to resize multiple images at once?

hello. i have a section on my profile with lots of stamps, and i'd like to resize them all to 99x56 px. is there a way i can assign this size to them all at once, or would i have to individually go through every image and enter that width and height?

thank you in advance! <3


Report Topic

3 Replies

Sort Replies:

Reply by Ikoe

posted

Because you've already got them all bunched up into one div with no other type of imagery in there, you can just blanket-tag every <img> instance in there with your width/height of choice by assigning that div an ID, and then doing #id_name img { width: 99px; height: 56px; }. (In addition, you canβ€”and shouldβ€”shove that div's in-line styling into that ID while you're at it.)

Here's an example of what that ends up looking like:

<style>
#stamps {
height: 300px;
overflow-y: scroll;
background-color: rgba(216, 229, 235, 0.70);
border: 3px dotted #fff; border-radius: 15px;
}

#stamps img {
width: 99px; height: 56px;
}
</style>

(...)

<div id="stamps">
[[ your stamps go here, duh ]]
</div>


Report Reply

Reply by JELLY πŸ‰

posted

thank you so much! your explanation was really easy to understand, and i'm grateful you decided to help :)


Report Reply

Reply by Ikoe

posted

Happy to lend a hand! Going forward, I'd strongly suggest utilizing both Stack Overflow for queries that seem like they've been a thorn in someone else's side at one time or another, and/or the MDN Web Docs for in-depth rundowns + examples (usually) for almost every aspect of HTML and CSS.
Best of luck with your future coding endeavours. ^^


Report Reply