当前位置:首页 > CSS

css制作水调歌头

2026-02-13 04:38:39CSS

CSS制作《水调歌头》效果

使用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;
}

文字渐显动画

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

css制作水调歌头

@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可以实现毛笔书写效果:

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

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

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

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

相关文章

css制作三角形

css制作三角形

使用 border 属性创建三角形 通过设置元素的 border 属性可以实现三角形效果。原理是利用边框的交界处形成的斜边。 .triangle { width: 0; height: 0;…

css动画制作

css动画制作

CSS动画制作方法 使用@keyframes规则定义动画序列,通过animation属性将动画应用到元素上。以下是一个基础示例: @keyframes fadeIn { from { opac…

css 制作三角形

css 制作三角形

使用 CSS 制作三角形的方法 边框法(Border Method) 通过设置元素的宽高为0,并利用边框的透明属性来创建三角形。这是最常见且兼容性最好的方法。 向上三角形 .triangl…

如何制作css

如何制作css

创建CSS文件 新建一个纯文本文件,将文件扩展名改为.css,例如style.css。确保文件名不含空格或特殊字符,使用连字符或下划线分隔单词。 编写CSS语法 CSS规则由选择器和声明块组成。选择…

css制作半圆

css制作半圆

使用 border-radius 制作半圆 通过设置 border-radius 属性,可以将矩形的边角弯曲成圆弧形状。制作半圆的关键是将宽度和高度设置为 2:1 的比例,并只对两个角应用圆角。 .…

css文件怎么制作

css文件怎么制作

创建CSS文件的基本步骤 CSS文件用于定义网页的样式,可以与HTML文件分离,便于管理和维护。以下是创建CSS文件的方法: 新建文本文件 使用任意文本编辑器(如Notepad++、VS Code…