<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <title>42度空间-弹性布局(flexbox) 之 align-items测试</title>
    <style>
        .box {
            display: flex;
            border : 1px solid #ccc;
            margin:0.5em;
        }
        .item {
            color:#fff;
            background: #000;
            padding: 0.5em 1em;
            margin: 0.5em;
            text-align: center;
        }
        .height4 {
            padding-top: 1em;
            min-height: 4em;
        }
        .height6 {
            padding-top: 2em;
            min-height: 6em;
        }
        label {
            padding: 2px 4px;
            font-size: 90%;
            color: #c7254e;
            background-color: #f9f2f4;
            border-radius: 4px;
        }
    </style>
</head>
<body>
<div id="wrapper">
    <label for="box1" id="my-label">align-items: stretch; </label>
    <div class="box" id="box1">
        <div class="item">1 简 </div>
        <div class="item height4">2 过早的优化是罪恶之源。</div>
        <div class="item height6">3 简单不先于复杂,而是在复杂之后。</div>
    </div>
</div>
<script type="text/javascript" src="http://res.42du.cn/vendor/jquery/jquery.min.js"></script>
<script>
    $(document).ready(function () {
        var vals = ["stretch","flex-start","flex-end","center","baseline"];
        var i = 1;
        var stop = false;
        var id = setInterval(function () {
            if(!stop) {
                $("#my-label").html("align-items: "+vals[i]+";");
                $("#box1").css("align-items",vals[i]);
                i++;
                i = i > 4 ? 0 : i;
            }
        },2000);
        $("#wrapper").click(function () {
            stop = !stop;
        });
    });
</script>
</body>
</html>