运行结果尺寸: 300 x 150
x
 
<!DOCTYPE html>
<html lang="en">
<head>
<title>CSS 模板</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
  box-sizing: border-box;
}
body {
  font-family: Arial, Helvetica, sans-serif;
}
/* 样式表头 */
.header {
  background-color: #f1f1f1;
  padding: 30px;
  text-align: center;
  font-size: 35px;
}
/* 创建三个不等的并排浮动的列 */
.column {
  float: left;
  padding: 10px;
  height: 300px; /* 应该移除。 仅供演示 */
}
/* 左栏和右栏 */
.column.side {
  width: 25%;
}
/* 中间栏 */
.column.middle {
  width: 50%;
}
/* 清除列后的浮点数 */
.row:after {
  content: "";
  display: table;
  clear: both;
}
/* 样式页脚 */
.footer {
  background-color: #f1f1f1;
  padding: 10px;
  text-align: center;
}
/* 响应式布局 - 使三列堆叠在彼此之上而不是彼此相邻 */
@media (max-width: 600px) {
  .column.side, .column.middle {
    width: 100%;
  }
}
</style>
</head>
<body>
<h2>使用浮动的 CSS 模板</h2>
<p>在此示例中,我们创建了一个页眉、三个不相等的列和一个页脚。 在较小的屏幕上,这些列将相互堆叠。</p>
<p>调整浏览器窗口大小以查看响应效果。</p>
<div class="header">
  <h2>页眉</h2>
</div>
<div class="row">
  <div class="column side" style="background-color:#aaa;">栏目</div>
  <div class="column middle" style="background-color:#bbb;">栏目</div>
  <div class="column side" style="background-color:#ccc;">栏目</div>
</div>
<div class="footer">
  <p>页脚</p>
</div>
</body>
</html>
×

报个问题: