三栏布局移动优先设计
Sunny-117 opened this issue · comments
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
.container {
display: flex;
flex-direction: column;
}
.sidebar {
background-color: lightgray;
padding: 10px;
}
.main-content {
background-color: lightblue;
}
@media screen and (min-width: 768px) {
.container {
flex-direction: row;
}
.sidebar {
flex-basis: 200px;
}
.main-content {
flex-grow: 1;
margin: 0 10px;
}
}
</style>
</head>
<body>
<div class="container">
<div class="sidebar">Sidebar</div>
<div class="main-content">Main Content</div>
<div class="sidebar">Sidebar</div>
</div>
</body>
</html>