1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
|
<!DOCTYPE html>
<html>
<title>CSS Flexbox: flex-basis with zero pixel</title>
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#flex-basis-property">
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#intrinsic-main-sizes">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<link href="support/flexbox.css" rel="stylesheet">
<meta name="assert" content="This test ensures that setting 'flex-basis' property to
zero pixel or percentage in combination with one value of both 'flex-grow' and 'flex-shrink'
and 'writing-mode' value works properly.">
<style>
.flexbox > div {
font: 14px/1 Ahem;
min-width: 0;
min-height: 0;
}
.flex-zero {
flex: 0;
}
.flex-zero-one-zero-percent {
flex: 0 1 0%;
}
.flex-zero-one-zero-px {
flex: 0 1 0px;
}
.flex-half {
flex: 0.5;
}
.flex-half-one-zero-percent {
flex: 0.5 1 0%;
}
.flex-half-one-zero-px {
flex: 0.5 1 0px;
}
.flex-one-one-zero-percent {
flex: 1 1 0%;
}
.flex-one-one-zero-px {
flex: 1 1 0px;
}
.vertical {
writing-mode: vertical-rl;
}
</style>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>
<body onload="document.fonts.ready.then(() => { checkLayout('.flexbox'); })">
<div id=log></div>
<div class="flexbox column">
<div class="flex-zero" data-expected-height="14">Flex item with flex: 0</div>
</div>
<div class="flexbox column">
<div class="flex-zero-one-zero-percent" data-expected-height="14">Flex item with flex: 0 1 0%</div>
</div>
<div class="flexbox column">
<div class="flex-zero-one-zero-px" data-expected-height="0">Flex item with flex: 0 1 0px</div>
</div>
<div class="flexbox column">
<div class="flex-half" data-expected-height="14">Flex item with flex: 0.5</div>
</div>
<div class="flexbox column">
<div class="flex-half-one-zero-percent" data-expected-height="14">Flex item with flex: 0.5 1 0%</div>
</div>
<!-- Following comment follows current spec to the letter, but it is not web
compatible. The expectation is for what everyone is shipping. -->
<!-- A flex-grow of 0 would size the container to the flex base size of the item (0px),
and a flex-grow of 1 would size it to the max-content contribution of the item (14px).
Therefore, a flew-grow of 0.5 sizes the container to the average, 7px.
And then the item grows to fill half of that, 3.5px.
Note that Gecko, Blink and WebKit use the flex-basis instead. -->
<div class="flexbox column">
<div class="flex-half-one-zero-px" data-expected-height="0">Flex item with flex: 0.5 1 0px</div>
</div>
<div class="flexbox column">
<div class="flex-one" data-expected-height="14">Flex item with flex: 1</div>
</div>
<div class="flexbox column">
<div class="flex-one-one-zero-percent" data-expected-height="14">Flex item with flex: 1 1 0%</div>
</div>
<!-- Following comment follows current spec to the letter, but it is not web
compatible. The expectation is for what everyone is shipping. -->
<!-- flex-grow is >= 1, so the flex container is sized to the max-content contribution of the item.
Note that Gecko, Blink and WebKit use the flex-basis instead. -->
<div class="flexbox column">
<div class="flex-one-one-zero-px" data-expected-height="0">Flex item with flex: 1 1 0px</div>
</div>
<div class="flexbox column vertical">
<div class="flex-zero" data-expected-width="14">Flex item with flex: 0</div>
</div>
<div class="flexbox column vertical">
<div class="flex-zero-one-zero-percent" data-expected-width="14">Flex item with flex: 0 1 0%</div>
</div>
<div class="flexbox column vertical">
<div class="flex-zero-one-zero-px" data-expected-width="0">Flex item with flex: 0 1 0px</div>
</div>
<div class="flexbox column vertical">
<div class="flex-half" data-expected-width="14">Flex item with flex: 0.5</div>
</div>
<div class="flexbox column vertical">
<div class="flex-half-one-zero-percent" data-expected-width="14">Flex item with flex: 0.5 1 0%</div>
</div>
<!-- Following comment follows current spec to the letter, but it is not web
compatible. The expectation is for what everyone is shipping. -->
<!-- A flex-grow of 0 would size the container to the flex base size of the item (0px),
and a flex-grow of 1 would size it to the max-content contribution of the item (14px).
Therefore, a flew-grow of 0.5 sizes the container to the average, 7px.
And then the item grows to fill half of that, 3.5px.
Note that Gecko, Blink and WebKit use the flex-basis instead. -->
<div class="flexbox column vertical">
<div class="flex-half-one-zero-px" data-expected-width="0">Flex item with flex: 0.5 1 0px</div>
</div>
<div class="flexbox column vertical">
<div class="flex-one" data-expected-width="14">Flex item with flex: 1</div>
</div>
<div class="flexbox column vertical">
<div class="flex-one-one-zero-percent" data-expected-width="14">Flex item with flex: 1 1 0%</div>
</div>
<!-- Following comment follows current spec to the letter, but it is not web
compatible. The expectation is for what everyone is shipping. -->
<!-- flex-grow is >= 1, so the flex container is sized to the max-content contribution of the item.
Note that Gecko, Blink and WebKit use the flex-basis instead. -->
<div class="flexbox column vertical">
<div class="flex-one-one-zero-px" data-expected-width="0">Flex item with flex: 1 1 0px</div>
</div>
</body>
</html>
|