CSS: Width and Max-Width

后端 未结 9 1521
無奈伤痛
無奈伤痛 2020-12-02 18:01

Why does:

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

do the same as

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

The first one make

9条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-02 18:11

    Probably in your first case 98% is equal or more than 1140px, so it will stick at 1140px.

    In the second case of course, the width is 1140px, so it will stick to 1140px, and the max-width become useless.

    Update Try it here http://jsfiddle.net/

提交回复
热议问题