{"id":243886,"date":"2016-07-26T06:29:34","date_gmt":"2016-07-26T13:29:34","guid":{"rendered":"http:\/\/css-tricks.com\/?p=243886"},"modified":"2019-03-24T07:12:33","modified_gmt":"2019-03-24T14:12:33","slug":"tale-width-max-width","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/tale-width-max-width\/","title":{"rendered":"A Tale of `width` and `max-width`"},"content":{"rendered":"

An interesting conversation came up in the comment thread of one of our posts last week, Considerations for Styling a Modal<\/a>.<\/p>\n

<\/p>\n

You might want to limit the width of a modal, right? Kinda gives it that “modal” look on larger screens. Let’s say 600px sounds right. But, you want to make sure it doesn’t bust outside of its parent element. For example, avoid causing horizontal scrolling on a mobile screen.<\/p>\n

How would you do that?<\/p>\n

    \n
  1. width: 600px; max-width: 100%;<\/code><\/li>\n
  2. width: 100%; max-width: 600px;<\/code><\/li>\n<\/ol>\n

    The answer: it doesn’t really matter, they are the same thing.<\/p>\n

    Some people’s reactions<\/a>:<\/p>\n