画面幅が変わる度、カラム構成を変える Bootstrap

smの時は3:9、xsの時は5:7という風にレイアウト構成を画面の大きさによって変えられます。

<!DOCTYPE html>
<html lang="ja">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap 101 Template</title>

<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<style>
#header {
    background-color: red;
    height: 100px;
}
.row {
    background-color: gray;
    height: 300px;
}
.side {
    background-color: green;
    height: 50px;
    margin: 10px 0;
}
.main {
    background-color: pink;
    height: 50px;
    margin: 10px 0;
}

</style>

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
    <div id="header" class="container">header</div>
    </div>
    <div class="container">
        <div class="row">
            <div class="col-sm-3 col-xs-5 side"></div>
            <div class="col-sm-9 col-xs-7 main"></div>
        </div>
    </div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>


f:id:hrt0kmt:20141018103127p:plain

f:id:hrt0kmt:20141018103137p:plain