<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>简单网页布局</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f2f2f2;
        }

        header {
            background-color: #333;
            color: white;
            text-align: center;
            padding: 1em;
        }

        nav {
            background-color: #f0f0f0;
            padding: 1em;
        }

        nav ul {
            list-style-type: none;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
        }

        nav li {
            margin-right: 20px;
        }

        section {
            padding: 20px;
            margin: 20px;
            background-color: white;
        }

        footer {
            background-color: #333;
            color: white;
            text-align: center;
            padding: 1em;
        }
    </style>
</head>
<body>

    <header>
        <h1>我的网页</h1>
    </header>

    <nav>
        <ul>
            <li><a href="#">首页</a></li>
            <li><a href="#">关于我们</a></li>
            <li><a href="#">联系我们</a></li>
        </ul>
    </nav>

    <section>
        <h2>欢迎访问我的网页</h2>
        <p>这是一个简单的网页布局示例。</p>
    </section>

    <footer>
        <p>&copy; 2023 我的网页</p>
    </footer>

</body>
</html>

这是一个基本的网页布局,包括页头(header)、导航栏(nav)、内容区域(section)和页脚(footer)。你可以根据自己的需求进行修改和扩展。


转载请注明出处:http://www.zyzy.cn/article/detail/4022/CSS