Ask coding questions

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

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 (695) [earned 5 cycles]
View Answer
malvoliothegood (695)

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:

Paultheriault (9)

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

malvoliothegood (695)

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