HTML实现个人网页制作

时间:2025-03-30 08:38:13
  • <!DOCTYPE html>
  • <html>
  • <head>
  • <title>网页标题</title>
  • <style type="text/css">
  • /* 样式表 */
  • body {
  • margin: 0;
  • padding: 0;
  • font-family: Arial, sans-serif;
  • }
  • header {
  • background-color: #333;
  • color: #fff;
  • padding: 20px;
  • text-align: center;
  • }
  • nav {
  • background-color: #eee;
  • padding: 10px;
  • }
  • nav ul {
  • list-style-type: none;
  • margin: 0;
  • padding: 0;
  • display: flex;
  • justify-content: center;
  • }
  • nav li {
  • margin: 0 10px;
  • }
  • nav a {
  • color: #333;
  • text-decoration: none;
  • font-size: 18px;
  • }
  • nav a:hover {
  • color: #fff;
  • background-color: #333;
  • padding: 5px 10px;
  • border-radius: 5px;
  • }
  • .container {
  • max-width: 1200px;
  • margin: 0 auto;
  • display: flex; /* 使用 flexbox 布局 */
  • flex-wrap: wrap;
  • justify-content: center;
  • }
  • .group {
  • display: flex; /* 使用 flexbox 布局 */
  • flex-direction: row;
  • align-items: center;
  • }
  • .box {
  • width: 300px;
  • margin: 20px;
  • box-shadow: 0 0 10px rgba(0,0,0,0.3);
  • overflow: hidden;
  • border-radius: 5px;
  • }
  • .box img {
  • width: 100%;
  • height: 200px;
  • object-fit: cover;
  • }
  • .box h3 {
  • margin: 10px;
  • font-size: 24px;
  • text-align: center;
  • }
  • .box p {
  • margin: 10px;
  • font-size: 16px;
  • line-height: 1.5;
  • text-align: justify;
  • }
  • </style>
  • </head>
  • <body>
  • <nav>
  • <ul>
  • <li><a href="#">首页</a></li>
  • <li><a href="#">我的资料</a></li>
  • <li><a href="#">人生大事</a></li>
  • <li><a href="#">历史经历</a></li>
  • </ul>
  • </nav>
  • <div class="container">
  • <div class="group">
  • <div class="box">
  • <img src="/300/200" alt="图片1">
  • <h3>标题1</h3>
  • <p>内容1</p>
  • </div>
  • <div class="box">
  • <img src="/300/201" alt="图片2">
  • <h3>标题2</h3>
  • <p>内容2</p>
  • </div>
  • <div class="box">
  • <img src="/300/202" alt="图片3">
  • <h3>标题3</h3>
  • <p>内容3</p>
  • </div>
  • </div>
  • <div class="group">
  • <div class="box">
  • <img src="/300/203" alt="图片4">
  • <h3>标题4</h3>
  • <p>内容4</p>
  • </div>
  • <div class="box">
  • <img src="/300/204" alt="图片5">
  • <h3>标题5</h3>
  • <p>内容5</p>
  • </div>
  • <div class="box">
  • <img src="/300/205" alt="图片6">
  • <h3>标题6</h3>
  • <p>内容6</p>
  • </div>
  • </div>
  • <div class="group">
  • <div class="box">
  • <img src="/300/206" alt="图片7">
  • <h3>标题7</h3>
  • <p>内容7</p>
  • </div>
  • <div class="box">
  • <img src="/300/207" alt="图片8">
  • <h3>标题8</h3>
  • <p>内容8</p>
  • </div>
  • <div class="box">
  • <img src="/300/208" alt="图片9">
  • <h3>标题9</h3>
  • <p>内容9</p>
  • </div>
  • </div>
  • </div>
  • </body>
  • </html>