As I work on optimizing a news site for mobile, I am facing the challenge of making images fit within the entire width of the div container dynamically. The original image size is 240px in width, and I need to adjust it accordingly based on different screen sizes. Currently, this is my CSS code:
.thumb { float: left; clear: both; width: 100%; height: auto; margin: 0; }
.thumb img { max-width: 100%; max-height: 100%; }
However, when viewed on an iPhone with a 320px width, the image appears slightly smaller as the container size is larger. This issue would be more pronounced on landscape mode at 480px. I need suggestions on how to make the images adapt flexibly to different screen sizes.