Why we use both max-width and width in a container?

.container {
  max-width: 1000px;
  width: 100%;
  margin:0 auto;
}

You don’t want the image to get too big so max-width takes care of that. You want the image to fill all available space so setting width to 100% will take care of that. This allows the image to resize as the width of the browser changes.

2 Likes

That’s great, thank you @bbsmooth for the response.