why does an image spill out of a container even with padding on the container set?

just a general question on why something like this happens
12 Replies
b1mind
b1mind2y ago
You will need to provide some code as its not as cut and dry as you may think it is.
beans
beansOP2y ago
k
b1mind
b1mind2y ago
We can assume you have a hard value for height/width (which you should with images as attributes). So you need to either put a max-width: 100% on it or handle appropriately
beans
beansOP2y ago
i have a max-width container:
display: flex; justify-content: space-between; padding: 8% 8%; background-image: url(bg-img.jpg); background-size: cover; background-repeat: no-repeat; position: relative; isolation: isolate; gap: 8%;
b1mind
b1mind2y ago
This is why code is so important cause now we are talking about a Background-image
beans
beansOP2y ago
image container(first one) and image: .hero-container .hero-img { display: flex; justify-content: flex-end; flex-basis: 60%; } .hero-container .hero-img img { width: clamp(30rem, 100%, 40rem); height: auto; } no not a background image
b1mind
b1mind2y ago
put it in a codepen is best fyi
beans
beansOP2y ago
lemme remove that but theres so much other code i need to write to replicate the situation but ok ig or maybe i can just send the file
b1mind
b1mind2y ago
You can either create more work for the person helping or less. The idea of giving a working demo allows people to jus tackle your issue. Without extra steps. This also eliminates lots of assumptions tbh. Like you said you have a max-width but then show us* a class with width: clamp(30rem, 100%, 40rem);
beans
beansOP2y ago
how do you use images in codepen i tried linking with external websites but it wasnt working out for me
b1mind
b1mind2y ago
I typically just use filler from https://picsum.photos You can link any external images with a fully hosted url though like if they are on github you can get the raw link and use it
beans
beansOP2y ago
k thx i actually think ill tackle this problem another day, so adios
Want results from more Discord servers?
Add your server