Ask coding questions

← Back to all posts
Making sizing responsive and inherited from container element. HTML CSS & JS
h
Paultheriault (3)

I am stuck on this last point. Can someone have a look and give me a hint.
1. The <img> element should responsively resize, relative to the width of its parent element, without exceeding its original size.

Answered by malvoliothegood (255) [earned 5 cycles]
View Answer
Commentshotnewtop
malvoliothegood (255)

@Paultheriault
There are quite a few errors in your CSS file. For example you have misplaced semi-colons main {;. Your HTML tags are messed up as well. Look at this repl. I think it does what you want and I have commented the CSS: https://repl.it/@malvoliothegood/image-resizing

Paultheriault (3)

@malvoliothegood Thanks, I started it over from scratch and cleaned up the erroneous b.s. Now it works like a charm. Thanks again.

malvoliothegood (255)

Code please. Also I have looked at your Java Processing using Processing repl and can suggest a correction. The file that holds the Processing code normally uses pde rather than java as a file extension, so index.pde instead of index.java.