3 Column Fixed

by Kissy

HTML

<!DOCTYPE html>
<html lang="ja">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        
        <title>Flexbox Layout(3 Columns)</title>
        <link rel="stylesheet" href="css/3columns-fixed.css">
    </head>
    <body>
        <div class="container">
            <div class="item">Item 1</div>
            <div class="item">Item 2</div>
            <div class="item">Item 3</div>
        </div>
    </body>
</html>

CSS

*, *:before, *:after {
    box-sizing: border-box;
}

.container {
    display: flex;
    flex-wrap: wrap;
}

.item {
    flex: 0 1 33.3333%;
}

@media (max-width: 320) {
    .item {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

html {
    font-size: 16px;
}

.container {
    border: 1px solid #aaa;
}

.item {
    height: 200px;
    padding: 8px;
    border: 1px solid #fff;
    background: #00aaff;
    color: #fff;
    text-align: center;
    line-height: 200px;
}