CSS: Width and Max-Width

Viewed 36582

Why does:

width: 98%;
max-width: 1140px;

do the same as

width: 1140px;
max-width: 98%;

The first one makes sense in that I'm saying the width is 98% but don't go larger than 1140px wide.

The second one however would say the page is 1140px wide but then WOULD go as large as the page at 98% right? So e.g past 1140px... but apparently not, as it does the same as the first.

Can someone explain why?

9 Answers

Use only

max-width: 1140px;

or

width: 98%;

not both. If you want to see the difference go here.

Related