max-width

#main {
  max- 600px;
  margin: 0 auto; 
}

<div id="main">

Using max-width instead of width in this situation will improve the browser's handling of small windows. This is important when making a site usable on mobile. Resize this page to check it out!

By the way, max-width is supported by all major browsers including IE7+ so you shouldn't be afraid of using it.

原文地址:https://www.cnblogs.com/human/p/3357123.html