gpt4 book ai didi

css - w3c css2.1规范中may和must有什么区别?

转载 作者:行者123 更新时间:2023-11-28 17:59:06 24 4
gpt4 key购买 nike

w3c css2.1规范中may和must的区别是什么?

例如 the section 9.5.1

Here are the precise rules that govern the behavior of floats:

1.The left outer edge of a left-floating box may not be to the left of the left edge of its containing block. An analogous rule holds for right-floating elements.

2.If the current box is left-floating, and there are any left-floating boxes generated by elements earlier in the source document, then for each such earlier box, either the left outer edge of the current box must be to the right of the right outer edge of the earlier box, or its top must be lower than the bottom of the earlier box. Analogous rules hold for right-floating boxes.

3.The right outer edge of a left-floating box may not be to the right of the left outer edge of any right-floating box that is next to it. Analogous rules hold for right-floating elements.

4.A floating box's outer top may not be higher than the top of its containing block. When the float occurs between two collapsing margins, the float is positioned as if it had an otherwise empty anonymous block parent taking part in the flow. The position of such a parent is defined by the rules in the section on margin collapsing.

5.The outer top of a floating box may not be higher than the outer top of any block or floated box generated by an element earlier in the source document.

6.The outer top of an element's floating box may not be higher than the top of any line-box containing a box generated by an element earlier in the source document.

7.A left-floating box that has another left-floating box to its left may not have its right outer edge to the right of its containing block's right edge. (Loosely: a left float may not stick out at the right edge, unless it is already as far to the left as possible.) An analogous rule holds for right-floating elements.

8.A floating box must be placed as high as possible.

9.A left-floating box must be put as far to the left as possible, a right-floating box as far to the right as possible. A higher position is preferred over one that is further to the left/right.

规则一用了“可以”这个词,意思是规则一可能不被执行?规则8使用了“必须”这个词。那么这意味着如果实现没有实现规则8,它会被认为是实现的错误吗?

最佳答案

Section 3.1 CSS 2.1(推荐) 说:

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 (see [RFC2119]). However, for readability, these words do not appear in all uppercase letters in this specification.

RFC 2119: Key words for use in RFCs to Indicate Requirement Levels

您对术语的理解似乎是正确的:

1. MUST
[…] the definition is an absolute requirement of the specification.

[…]

5. MAY […] an item is truly optional. One vendor may choose to include the item because a particular marketplace requires it or because the vendor feels that it enhances the product while another vendor may omit the same item. […]

关于css - w3c css2.1规范中may和must有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20795924/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com