写一个flexbox布局的页面
时间: 2023-12-19 17:07:14 浏览: 35
好的,我可以回答这个问题。Flexbox是一种CSS布局模式,用于在Web页面上创建灵活的、可响应的布局。以下是一个简单的Flexbox布局页面的示例代码:
<!DOCTYPE html>
<html>
<head>
<title>Flexbox Layout Example</title>
<style>
body {
display: flex;
flex-direction: column;
height: 100vh;
margin: 0;
padding: 0;
}
header {
background-color: #333;
color: #fff;
padding: 10px;
text-align: center;
}
main {
display: flex;
flex: 1;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 10px;
}
aside {
background-color: #ccc;
flex-basis: 20%;
padding: 10px;
}
article {
background-color: #eee;
flex-basis: 75%;
padding: 10px;
}
footer {
background-color: #333;
color: #fff;
padding: 10px;
text-align: center;
}
</style>
</head>
<body>
<header>
<h1>Flexbox Layout Example</h1>
</header>
<main>
<aside>
<h2>Sidebar</h2>
<p>This is the sidebar content.</p>
</aside>
<article>
<h2>Main Content</h2>
<p>This is the main content area.</p>
</article>
</main>
<footer>
<p>© 2021 Flexbox Layout Example</p>
</footer>
</body>
</html>
希望这个示例对你有所帮助!