Image not resizing

I could resize an image in any way I wanted, but as soon as i added alt text, the image resized itself to its default size and i couldn't make it smaller no matter what.
No description
No description
No description
6 Replies
Lavy
LavyOP3mo ago
Here's what happens when i remove the alt text
No description
ἔρως
ἔρως3mo ago
your image is missing a source no source means an error which will display the alt text if you absolutely must do this with a background image, use a transparent svg image as the source something like data:image/svg+xml,%3Csvg%20width=1%20height=1/%3E if that doesn't work, replace %20 with a space if that still doesn't work, add single quotes around the 1
Mannix
Mannix3mo ago
or use picture element if you need to change the image based on the viewport size
Lavy
LavyOP3mo ago
well, the image is supposed to change when the screen is larger, so i set it through content in css i'm playing around with it and i now removed the img and added content to the section and i seems to work just fine the only problem is the img is not proportional anymore tho i just realized i don't have alt text anymore that works! Thank you guys, i appreciate your help :thanks:
ἔρως
ἔρως3mo ago
picture is the right element by the way, you can use webp instead of jpeg, to save on bandwidth
Lavy
LavyOP3mo ago
thank you for the advice

Did you find this page helpful?