制作个人网页css
基础CSS框架搭建
新建一个style.css文件,写入基础样式:
/* 全局样式 */
body {
font-family: 'Arial', sans-serif;
line-height: 1.6;
margin: 0;
padding: 0;
color: #333;
background-color: #f4f4f9;
}
/* 容器布局 */
.container {
width: 80%;
margin: 0 auto;
padding: 20px;
}
导航栏设计
使用Flexbox实现响应式导航:

nav {
background: #2c3e50;
padding: 1rem 0;
}
nav ul {
display: flex;
justify-content: space-around;
list-style: none;
padding: 0;
}
nav a {
color: white;
text-decoration: none;
padding: 0.5rem 1rem;
transition: background 0.3s;
}
nav a:hover {
background: #3498db;
}
响应式布局处理
通过媒体查询适配移动设备:
@media (max-width: 768px) {
.container {
width: 95%;
}
nav ul {
flex-direction: column;
align-items: center;
}
}
卡片式内容区域
为个人项目或经历添加卡片效果:

.card {
background: white;
border-radius: 8px;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
padding: 20px;
margin-bottom: 20px;
}
.card h3 {
border-bottom: 1px solid #eee;
padding-bottom: 10px;
}
动画效果增强
为按钮或图标添加简单动画:
.button {
background: #3498db;
color: white;
padding: 10px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
transition: transform 0.2s, background 0.3s;
}
.button:hover {
background: #2980b9;
transform: translateY(-2px);
}
字体与配色方案
推荐使用Google Fonts和配色工具:
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');
:root {
--primary-color: #3498db;
--secondary-color: #2c3e50;
--accent-color: #e74c3c;
}






