欢迎来到我的博客
这是我的第一篇博客文章,用来测试代码高亮功能。
Python示例
1
2
3
4
5
6
7
| def hello_world():
print("Hello, World!")
for i in range(5):
print(f"计数: {i}")
hello_world()
|
JavaScript示例
1
2
3
4
5
6
7
8
9
10
11
| function helloWorld() {
console.log("Hello, World!");
// 箭头函数示例
const numbers = [1, 2, 3, 4, 5];
const squared = numbers.map(num => num * num);
console.log(squared); // [1, 4, 9, 16, 25]
}
helloWorld();
|
CSS示例
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| .container {
display: flex;
justify-content: center;
align-items: center;
background-color: #f0f0f0;
border-radius: 8px;
padding: 20px;
}
.container:hover {
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
transform: translateY(-2px);
transition: all 0.3s ease;
}
|
HTML示例
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| <!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>测试页面</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<h1>Hello World!</h1>
<p>这是一个测试页面</p>
</div>
<script src="script.js"></script>
</body>
</html>
|