blob: f25900bc41576780182ce024114f478e72170223 [file] [log] [blame]
<!DOCTYPE html>
<html>
<style>
body {
margin: 0;
}
.flexbox {
width: 600px;
display: -webkit-flex;
background-color: #aaa;
position: relative;
}
.flexbox div {
height: 20px;
border: 0;
-webkit-flex: none;
}
.flexbox :nth-child(1) {
background-color: blue;
}
.flexbox :nth-child(2) {
background-color: green;
}
.flexbox :nth-child(3) {
background-color: red;
}
</style>
<script src="../../resources/check-layout.js"></script>
<body onload="checkLayout('.flexbox')">
<div class="flexbox">
<div data-expected-width="100" data-offset-x="0" style="-webkit-flex: 1 0 0; max-width: 100px;"></div>
<div data-expected-width="100" data-offset-x="100" style="width: 100px;"></div>
<div data-expected-width="100" data-offset-x="200" style="width: 100px;"></div>
</div>
<div class="flexbox" style="-webkit-justify-content: flex-end">
<div data-expected-width="100" data-offset-x="300" style="-webkit-flex: 0 0 100px;"></div>
<div data-expected-width="100" data-offset-x="400" style="width: 100px;"></div>
<div data-expected-width="100" data-offset-x="500" style="width: 100px;"></div>
</div>
<div class="flexbox" style="-webkit-justify-content: center">
<div data-expected-width="100" data-offset-x="150" style="-webkit-flex: 1 0 0; max-width: 100px;"></div>
<div data-expected-width="100" data-offset-x="250" style="width: 100px;"></div>
<div data-expected-width="100" data-offset-x="350" style="width: 100px;"></div>
</div>
<div class="flexbox" style="-webkit-justify-content: center">
<div data-expected-width="200" data-offset-x="0" style="-webkit-flex: 1 100px;"></div>
<div data-expected-width="200" data-offset-x="200" style="-webkit-flex: 1 100px;"></div>
<div data-expected-width="200" data-offset-x="400" style="-webkit-flex: 1 100px;"></div>
</div>
<!-- True centering on overflow. -->
<div class="flexbox" style="-webkit-justify-content: center">
<div data-expected-width="800" data-offset-x="-100" style="width: 800px;"></div>
</div>
<div class="flexbox" style="-webkit-justify-content: space-between">
<div data-expected-width="100" data-offset-x="0" style="-webkit-flex: 1 0 0; max-width: 100px;"></div>
<div data-expected-width="100" data-offset-x="250" style="width: 100px;"></div>
<div data-expected-width="100" data-offset-x="500" style="width: 100px;"></div>
</div>
<div class="flexbox" style="-webkit-justify-content: space-between">
<div data-expected-width="200" data-offset-x="0" style="-webkit-flex: 1 100px;"></div>
<div data-expected-width="200" data-offset-x="200" style="-webkit-flex: 1 100px;"></div>
<div data-expected-width="200" data-offset-x="400" style="-webkit-flex: 1 100px;"></div>
</div>
<!-- If there's only one child, we justify-content: flex-start. -->
<div class="flexbox" style="-webkit-justify-content: space-between">
<div data-expected-width="100" data-offset-x="0" style="-webkit-flex: 1 0 0; max-width: 100px;"></div>
</div>
<div class="flexbox" style="-webkit-justify-content: space-around">
<div data-expected-width="100" data-offset-x="50" style="-webkit-flex: 1 0 0; max-width: 100px;"></div>
<div data-expected-width="100" data-offset-x="250" style="width: 100px;"></div>
<div data-expected-width="100" data-offset-x="450" style="width: 100px;"></div>
</div>
<!-- If there's only one child, we justify-content center. -->
<div class="flexbox" style="-webkit-justify-content: space-around">
<div data-expected-width="100" data-offset-x="250" style="-webkit-flex: 1 0 0; max-width: 100px;"></div>
</div>
<!-- True centering on overflow. -->
<div class="flexbox" style="-webkit-justify-content: space-around">
<div data-expected-width="800" data-offset-x="-100" style="width: 800px;"></div>
</div>
<!-- Make sure we don't crash with no children. -->
<div class="flexbox" style="-webkit-justify-content: space-around"></div>
<!-- margin:auto applies before justify-content. -->
<div class="flexbox" style="-webkit-justify-content: flex-end">
<div data-expected-width="100" data-offset-x="0" style="width: 100px;"></div>
<div data-expected-width="100" data-offset-x="100" style="width: 100px; margin-right: auto"></div>
<div data-expected-width="100" data-offset-x="500" style="width: 100px;"></div>
</div>
<!-- The justify-content does nothing here because we are shrinking. -->
<div class="flexbox" style="-webkit-justify-content: flex-end">
<div data-expected-width="200" data-offset-x="0" style="-webkit-flex: 0 1 300px;"></div>
<div data-expected-width="200" data-offset-x="200" style="width: 200px;"></div>
<div data-expected-width="200" data-offset-x="400" style="width: 200px;"></div>
</div>
<!-- We overflow the flexbox (no negative flexing) and align the end. The overflow is to the left. -->
<div class="flexbox" style="-webkit-justify-content: flex-end">
<div data-expected-width="300" data-offset-x="-100" style="-webkit-flex: 1 0 300px;"></div>
<div data-expected-width="200" data-offset-x="200" style="width: 200px;"></div>
<div data-expected-width="200" data-offset-x="400" style="width: 200px;"></div>
</div>
</body>
</html>