是max-width:auto == max-width:100%吗? [英] Is max-width:auto == max-width:100%?

查看:170
本文介绍了是max-width:auto == max-width:100%吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

max-width:auto;

等于

max-width: 100%?

如果没有,有什么区别?

And if not, what's the difference?

推荐答案

它们不相等。 auto 不是最大宽度的有效值。

They are not equal. auto is not a valid value for max-width.

如果您要查找的值表示此元素的宽度没有上限,则该值为 none (请参见 最大宽度 )。

If you're looking for a value that means "there is no upper bound for the width of this element", that value is none (see the spec on max-width).

none 也不等于100%。值100%表示元素最多只能与其包含块的约束一样宽(请参见 width 属性(有关百分比宽度的详细信息)。

none is not equal to 100% either, however. The value 100% means that an element can only be as wide as the constraints of its containing block at most (see the spec on the width property for details on percentage widths).

使用 none ,您仍然可以使元素的宽度大于其包含的块(通常会导致溢出),例如通过在元素上设置 width:150%。如果最大宽度为100%,则该限制将仅优先于150%设置。

With none, you could still cause the element to be wider than its containing block (which would typically result in overflow), e.g. by setting width: 150% on the element. With a max width of 100%, that limit would simply take precedence over the 150% setting.

这篇关于是max-width:auto == max-width:100%吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆