非标
此特征是非标准的,且不在标准轨道中。不要在面向 Web 的生产站点中使用它:它不适用于每个用户。实现之间可能存在大的不兼容性,且行为将来可能改变。
This is a property for controlling parts of the XUL box model. It does not match either the old CSS Flexible Box Layout Module drafts for '
box-flex
' (which were based on this property) or the behavior of '
-webkit-box-flex
' (which is based on those drafts). See
flexbox
for information about the current standard.
-moz-box-flex
and
-webkit-box-flex
CSS
properties specify how a
-moz-box
or
-webkit-box
grows to fill the box that contains it, in the direction of the containing box's layout.
/* <number> values */ -moz-box-flex: 0; -moz-box-flex: 2; -moz-box-flex: 3.5; -webkit-box-flex: 0; -webkit-box-flex: 2; -webkit-box-flex: 3.5; /* Global values */ -moz-box-flex: inherit; -moz-box-flex: initial; -moz-box-flex: unset; -webkit-box-flex: inherit; -webkit-box-flex: initial; -webkit-box-flex: unset;
box-flex
property is specified as a
<number>
. If the value is 0, the box does not grow. If it is greater than 0, the box grows to fill a proportion of the available space.
The containing box allocates the available extra space in proportion to the flex value of each of the content elements.
Content elements that have zero flex do not grow.
If only one content element has nonzero flex, then it grows to fill the available space.
Content elements that have the same flex grow by the same absolute amounts.
If the flex value is set using the element's
flex
attribute, then the style is ignored.
To make XUL elements in a containing box the same size, set the containing box's
equalsize
attribute to the value
always
. This attribute does not have a corresponding CSS property.
A trick to make all content elements in a containing box the same size, is to give them all a fixed size (e.g.
height: 0
), and the same
box-flex
value greater than zero (e.g.
-moz-box-flex: 1
).
| 初始值 |
0
|
|---|---|
| 适用于 |
elements that are direct children of an element with a CSS
display
value of
-moz-box
or
-moz-inline-box
or
-webkit-box
or
-webkit-inline-box
|
| 继承 | no |
| 计算值 | 如指定 |
| 动画类型 | discrete |
<number>
<!DOCTYPE html>
<html>
<head>
<title>-moz-box-flex example</title>
<style>
div.example {
display: -moz-box;
display: -webkit-box;
border: 1px solid black;
width: 100%;
}
div.example > p:nth-child(1) {
-moz-box-flex: 1; /* Mozilla */
-webkit-box-flex: 1; /* WebKit */
border: 1px solid black;
}
div.example > p:nth-child(2) {
-moz-box-flex: 0; /* Mozilla */
-webkit-box-flex: 0; /* WebKit */
border: 1px solid black;
}
</style>
</head>
<body>
<div class="example">
<p>I will expand to fill extra space</p>
<p>I will not expand</p>
</div>
</body>
</html>
Not part of any standard.
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
box-flex
弃用
非标
|
Chrome
完整支持
1
Prefixed
|
Edge
完整支持
12
Prefixed
|
Firefox
完整支持
1
Prefixed
|
IE 不支持 No |
Opera
完整支持
15
Prefixed
|
Safari
完整支持
3
Prefixed
|
WebView Android
完整支持
≤37
Prefixed
|
Chrome Android
完整支持
18
Prefixed
|
Firefox Android
完整支持
4
Prefixed
|
Opera Android
完整支持
14
Prefixed
|
Safari iOS
完整支持
1
Prefixed
|
Samsung Internet Android
完整支持
1.0
Prefixed
|
完整支持
不支持
非标。预期跨浏览器支持较差。
弃用。不要用于新网站。
用户必须明确启用此特征。
要求使用供应商前缀或不同名称。
-moz-context-properties
-moz-float-edge
-moz-force-broken-image-icon
-moz-image-region
-moz-orient
-moz-outline-radius
-moz-outline-radius-bottomleft
-moz-outline-radius-bottomright
-moz-outline-radius-topleft
-moz-outline-radius-topright
-moz-user-focus
-moz-user-input
-webkit-border-before
-webkit-box-reflect
-webkit-line-clamp
-webkit-mask-attachment
-webkit-mask-composite
-webkit-mask-position-x
-webkit-mask-position-y
-webkit-mask-repeat-x
-webkit-mask-repeat-y
-webkit-overflow-scrolling
-webkit-tap-highlight-color
-webkit-text-fill-color
-webkit-text-stroke
-webkit-text-stroke-color
-webkit-text-stroke-width
-webkit-touch-callout
box-align
box-direction
box-flex
box-flex-group
box-lines
box-ordinal-group
box-orient
box-pack