用css和html生成一个个人博客界面,要求使用原神的一个角色图片,有个性签名,自我介绍,并且能够简单的交互
时间: 2023-05-26 17:07:30 浏览: 62
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>个人博客</title>
<style>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
background-color: #f8f8f8;
font-family: Arial, Helvetica, sans-serif;
color: #333;
}
.header {
display: flex;
justify-content: center;
align-items: center;
height: 80px;
background-color: #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.header h1 {
font-size: 24px;
font-weight: bold;
letter-spacing: 2px;
}
.container {
display: flex;
flex-wrap: wrap;
max-width: 1000px;
margin: 0 auto;
padding: 30px;
}
.profile {
flex: 1;
min-width: 300px;
margin-right: 30px;
background-color: #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
padding: 20px;
text-align: center;
}
.profile img {
width: 100px;
height: 100px;
border-radius: 50%;
}
.profile h2 {
margin: 10px 0;
font-size: 20px;
font-weight: bold;
}
.profile p {
font-size: 16px;
line-height: 1.5;
margin-bottom: 20px;
}
.profile button {
padding: 10px 20px;
border: none;
background-color: #f44336;
color: #fff;
font-size: 16px;
cursor: pointer;
border-radius: 5px;
}
.profile button:hover {
background-color: #d32f2f;
}
.posts {
display: flex;
flex-wrap: wrap;
flex: 2;
background-color: #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
padding: 20px;
text-align: center;
}
.post {
flex: 1;
min-width: 200px;
margin: 10px;
border: 1px solid #ccc;
padding: 10px;
cursor: pointer;
}
.post:hover {
background-color: #eee;
}
.post h2 {
font-size: 18px;
font-weight: bold;
margin-bottom: 10px;
}
.post p {
font-size: 16px;
line-height: 1.5;
}
.post img {
max-width: 100%;
height: auto;
margin-bottom: 10px;
}
.post-date {
font-size: 14px;
margin-top: 5px;
color: #999;
}
</style>
</head>
<body>
<header class="header">
<h1>个人博客</h1>
</header>
<div class="container">
<div class="profile">
<img src="https://uploadstatic-sea.mihoyo.com/contentweb/20210406/2021040613211689646.png" alt="原神角色图片" />
<h2>Traveler</h2>
<p>一名喜欢冒险的旅行者</p>
<button>关注TA</button>
</div>
<div class="posts">
<div class="post">
<img src="https://uploadstatic-sea.mihoyo.com/contentweb/20210121/2021012113533170657.jpg" alt="图片1" />
<h2>这是文章标题1</h2>
<p>这是文章内容1,这是文章内容1,这是文章内容1,这是文章内容1,这是文章内容1,</p>
<span class="post-date">2021-07-01</span>
</div>
<div class="post">
<img src="https://uploadstatic-sea.mihoyo.com/contentweb/20210422/2021042221202759374.jpg" alt="图片2" />
<h2>这是文章标题2</h2>
<p>这是文章内容2,这是文章内容2,这是文章内容2,这是文章内容2,这是文章内容2,</p>
<span class="post-date">2021-07-02</span>
</div>
<div class="post">
<img src="https://uploadstatic-sea.mihoyo.com/contentweb/20210907/2021090710133457803.jpg" alt="图片3" />
<h2>这是文章标题3</h2>
<p>这是文章内容3,这是文章内容3,这是文章内容3,这是文章内容3,这是文章内容3,</p>
<span class="post-date">2021-07-03</span>
</div>
</div>
</div>
</body>
</html>