Minecraft 官网 - 前端程序员兼 UI 设计师打造的精美互动体验
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Minecraft 官网</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<nav>
<ul>
<li><a href="#">首页</a></li>
<li><a href="#">产品</a></li>
<li><a href="#">特性</a></li>
<li><a href="#">下载</a></li>
<li><a href="#">支持</a></li>
</ul>
</nav>
<header>
<h1>欢迎来到 Minecraft 官网</h1>
<p>探索无尽的创造与冒险!</p>
</header>
<section>
<div class="animation-container">
<h2>动画效果标题</h2>
<p>这里是动画效果的介绍文字。</p>
</div>
</section>
<script src="script.js"></script>
</body>
</html>
/* 导航栏样式 */
nav {
background-color: rgba(0, 0, 0, 0.5);
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 999;
}
<p>nav ul {
display: flex;
justify-content: space-around;
list-style: none;
padding: 0;
}</p>
<p>nav ul li {
margin: 10px;
}</p>
<p>nav ul li a {
color: white;
text-decoration: none;
font-weight: bold;
}</p>
<p>/* 顶部标题样式 */
header {
background-image: url("background.jpg");
background-size: cover;
height: 600px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: white;
}</p>
<p>header h1 {
font-size: 36px;
}</p>
<p>/* 动画效果容器样式 */
section {
background-color: #f2f2f2;
padding: 50px;
text-align: center;
}</p>
<p>.animation-container {
width: 400px;
margin: 0 auto;
}</p>
<p>/* 动画效果样式 */
.animation-container h2 {
font-size: 24px;
}</p>
<p>.animation-container p {
font-size: 16px;
}</p>
<p>/* 动画效果 */
.animation-container:hover {
animation: rotate 2s infinite;
}</p>
<p>@keyframes rotate {
0% {
transform: rotate(0deg);
}</p>
<p>100% {
transform: rotate(360deg);
}
}
// 在这里可以添加更多动态交互效果的代码</p>
原文地址: https://www.cveoy.top/t/topic/p5ao 著作权归作者所有。请勿转载和采集!