万金流
以码会友。 吾Q:578751655。 水平有限,轻喷,谢!

作为一个美工烂到家的人,每次想写点网页都很痛苦。

借助ai,备忘,待完善。

c1.css:

body {
    font-family: Arial, sans-serif;
    margin: 0 auto;
    padding: 0;
    background-color: #f4f4f4;
    max-width: 1000px;
    display: flex; /* 使用 flexbox */
    flex-direction: column; /* 纵向排列 */
    align-items: center; /* 水平居中 */

}

header {
    background-color: #4CAF50;
    color: white;
    padding: 10px 20px;
    text-align: center;
    width: 100%; /* 让 header 占满宽度 */

}

nav {
    margin: 20px 0;
}

nav a {
    margin: 0 15px;
    text-decoration: none;
    color: #4CAF50;
    font-weight: bold;
}

nav a:hover {
    text-decoration: underline;
}

.content {
    padding: 20px;
    background-color: white;
    margin: 0 auto;
    max-width: 800px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    width: 100%; /* 宽度为 100% 以便适应容器 */

}

footer {
    text-align: center;
    padding: 10px 0;
    background-color: #4CAF50;
    color: white;
    /* position: relative;
    bottom: 0; */
    width: 100%;
    margin-top: 20px;
}

index.html

<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>我的网站</title>
    <link rel="stylesheet" href="css/c1.css"> <!-- 引入外部 CSS 文件 -->
</head>

<body>

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

    <nav>
        <a href="#">首页</a>
        <a href="#">内容1</a>
        <a href="#">内容2</a>
        <a href="#">内容3</a>
    </nav>

    <div class="content">
        <h2>这里应该是主题内容这里应该是主题内容这里应该是主题内容,这里应该是主题内容这里应该是主题内容这里应该是主题内容,这里应该是主题内容这里应该是主题内容这里应该是主题内容,这里应该是主题内容这里应该是主题内容这里应该是主题内容,这里应该是主题内容这里应该是主题内容这里应该是主题内容,这里应该是主题内容这里应该是主题内容这里应该是主题内容,</h2>
    </div>

    <footer>
        xx公司版权所有
    </footer>

</body>

</html>
posted on 2020-01-02 17:07  万金流  阅读(254)  评论(0)    收藏  举报