代码示例:(标识:cssref_media_columns)
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
  box-sizing: border-box;
}

/* 创建并排浮动的四列 */
.column {
  float: left;
  width: 25%;
  padding: 20px;
}

/* 在列后清除浮动 */
.row:after {
  content: "";
  display: table;
  clear: both;
}

/* 如果屏幕宽度为 992 像素或更窄,则四列变为两列 */
@media screen and (max-width: 992px) {
  .column {
    width: 50%;
  }
}

/* 如果屏幕宽度为 600 像素或更窄,则列堆叠而不是并排 */
@media screen and (max-width: 600px) {
  .column {
    width: 100%;
  }
}
</style>
</head>
<body>

<h2>响应式四列布局</h2>
<p>请调整浏览器窗口的大小以查看响应效果。在宽度为 992px 或更窄的屏幕上,列会调整尺寸,将从四列变为为两列。在宽度为 600 像素或更小的屏幕上,这些列将堆叠,而不是并排。</p>

<div class="row">
  <div class="column" style="background-color:#aaa;">
  <h2>列 1</h2>
  <p>一些文本..</p>
  </div>
  <div class="column" style="background-color:#bbb;">
  <h2>列 2</h2>
  <p>一些文本..</p>
  </div>
  <div class="column" style="background-color:#ccc;">
  <h2>列 3</h2>
  <p>一些文本..</p>
  </div>
  <div class="column" style="background-color:#ddd;">
  <h2>列 4</h2>
  <p>一些文本..</p>
  </div>
</div>

</body>
</html>
运行结果: