When working with images, it can be tricky to set the original width while also ensuring it fits within a parent container. For example, if the parent container has a width of 1000px, you may want the image to have a max-width of 100%, but not exceed 1000px in its original size. In this case, it is important to adjust the image size accordingly.
img {max-width: 100%; width: 100%;};
.container {width: 1000px;};
Setting the image max-width to 100%
should preserve the original size, while setting width to 100%
is meant to prevent it from surpassing the parent container's 1000px width. However, sometimes this approach may not work as expected.
To clarify, the goal is for the image's original size to always remain under 1000px. If the image width exceeds this limit, it should automatically resize to fit within the 1000px boundary.