当前位置:首页 > CSS

css制作水调歌头

2026-02-13 04:38:39CSS

CSS制作《水调歌头》效果

使用CSS可以实现文字排版和动画效果来展示《水调歌头》这首词。以下是几种常见的实现方式:

基础文字排版

通过CSS设置字体、颜色和间距来美化文本显示:

.poem {
  font-family: "SimSun", serif;
  font-size: 18px;
  line-height: 1.8;
  color: #333;
  text-align: center;
  margin: 20px auto;
  max-width: 600px;
}

.title {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 15px;
}

.author {
  font-style: italic;
  margin-bottom: 30px;
}

文字渐显动画

为诗句添加逐字显示的动画效果:

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.line {
  opacity: 0;
  animation: fadeIn 0.5s forwards;
}

.line:nth-child(1) { animation-delay: 0.5s; }
.line:nth-child(2) { animation-delay: 1s; }
.line:nth-child(3) { animation-delay: 1.5s; }
/* 继续为每行设置不同的延迟 */

背景水波效果

创建水波背景增强意境:

.container {
  position: relative;
  overflow: hidden;
}

.water {
  position: absolute;
  bottom: 0;
  width: 200%;
  height: 100px;
  background: rgba(0, 150, 255, 0.3);
  border-radius: 50%;
  animation: wave 5s linear infinite;
}

@keyframes wave {
  0% { transform: translateX(0) rotate(0deg); }
  100% { transform: translateX(-50%) rotate(360deg); }
}

完整HTML结构示例

<div class="container">
  <div class="water"></div>
  <div class="poem">
    <div class="title">水调歌头</div>
    <div class="author">苏轼</div>
    <div class="line">明月几时有?把酒问青天。</div>
    <div class="line">不知天上宫阙,今夕是何年。</div>
    <!-- 其余诗句 -->
  </div>
</div>

进阶效果:毛笔书写动画

使用SVG和CSS可以实现毛笔书写效果:

css制作水调歌头

.stroke {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: draw 3s ease-in-out forwards;
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

这些CSS技术可以单独使用或组合使用,根据需求调整参数和样式,创造出符合《水调歌头》意境的网页展示效果。

标签: 水调歌头css
分享给朋友:

相关文章

css制作标尺

css制作标尺

使用CSS制作标尺的方法 方法一:使用线性渐变和伪元素 通过CSS的线性渐变和伪元素可以创建水平或垂直标尺。以下是一个水平标尺的示例代码: .ruler { width: 100%; he…

用css制作导航条

用css制作导航条

水平导航条制作 使用display: inline-block或flexbox实现水平导航 为<ul>和<li>设置样式消除默认列表样式 添加padding和margin控制间…

css图形制作

css图形制作

CSS 图形制作方法 使用 CSS 可以创建各种基本和复杂的图形,主要通过 border、transform、clip-path 等属性实现。以下是几种常见图形的实现方式: 三角形 通过设置元素的…

css如何制作未读图标

css如何制作未读图标

未读图标实现方法 通过CSS可以创建多种未读图标的样式,以下是几种常见的实现方式: 使用伪元素创建小红点 .unread-badge { position: relative; displa…

css制作tkd

css制作tkd

CSS 制作 TKD(Title, Keywords, Description) TKD(Title, Keywords, Description)是网页 SEO 优化的核心元素,通常通过 HTML…

页脚制作 css

页脚制作 css

页脚基础样式 使用CSS为页脚设置基础样式,通常包括背景色、文字颜色、内边距等属性。以下是一个常见示例: footer { background-color: #333; color: wh…