两行三列:将页面分成两行,将任一行分为三列。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>两行三列布局</title>
<style>
html, body {
margin: 0px;
}
header {
background-color: lightblue;
height: 150px;
}
#container {
background-color: lightgray;
height: 600px;
}
nav {
background-color: lightcoral;
height: 100%;
width: 200px;
float: left;
}
aside {
background-color: lightgreen;
height: 100%;
width: 200px;
float: right;
}
article {
background-color: lightseagreen;
height: 100%;
}
</style>
</head>
<body>
<header></header>
<div id="container">
<nav></nav>
<aside></aside>
<article>这是一个文本内容。</article>
</div>
</body>
</html>
三行两列:将页面分成三行,将任一行分为两列。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>三行两列布局</title>
<style>
html, body {
margin: 0px;
}
header {
background-color: lightpink;
height: 100px;
}
#container {
background-color: lightskyblue;
height: 500px;
}
footer {
background-color: lightyellow;
height: 150px;
}
nav {
background-color: lightcyan;
height: 100%;
width: 200px;
float: left;
}
article {
background-color: lightsalmon;
height: 100%;
margin-left: 200px;
}
</style>
</head>
<body>
<header></header>
<div id="container">
<nav></nav>
<article></article>
</div>
<footer></footer>
</body>
</html>