<!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>