Home Web Front-end HTML Tutorial Make interesting dynamic wavy lines of text with HTML/CSS

Make interesting dynamic wavy lines of text with HTML/CSS

Aug 27, 2021 pm 02:37 PM
css html

In the previous article " is very practical! CSS implements the dynamic effect of pressing when the button is clicked》Introduced how to use CSS to display the dynamic effect of pressing when the button is clicked. Friends in need can go and learn about it~

This article will show you how to use HTML/CSS to create an interesting dynamic wavy text line effect!

Let’s look directly at the complete code example:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

<!DOCTYPE HTML>

<html>

<head>

    <meta charset="UTF-8">

    <title></title>

    <style type="text/css">

        body {

            display: flex;

            justify-content: center;

            align-items: center;

            min-height: 100vh;

            background-color: rgb(74, 152, 255);

        }

 

        .wavy {

            position: relative;

        }

 

        .wavy span {

            position: relative;

            display: inline-block;

            color: #fff;

            font-size: 2em;

            text-transform: uppercase;

            animation: animate 2s ease-in-out infinite;

            animation-delay: calc(0.1s * var(--i));

        }

 

        @keyframes animate {

            0% {

                transform: translateY(0px);

            }

 

            20% {

                transform: translateY(-20px);

            }

 

            40%,

            100% {

                transform: translateY(0px);

            }

        }

    </style>

</head>

 

<body>

<div class="wavy">

    <span style="--i:1">P</span>

    <span style="--i:2">H</span>

    <span style="--i:3">P</span>

    <span style="--i:4">中</span>

    <span style="--i:5">文</span>

    <span style="--i:6">网</span>

    <span style="--i:7">开</span>

    <span style="--i:8">班</span>

    <span style="--i:9">啦</span>

    <span style="--i:10">~</span>

    <span style="--i:11">快</span>

    <span style="--i:12">学</span>

    <span style="--i:13">起</span>

    <span style="--i:14">来</span>

    <span style="--i:15">~</span>

    <span style="--i:16">~</span>

    <span style="--i:17">~</span>

 

</div>

</body>

</html>

Copy after login

The effect is as follows:

GIF 2021-8-27 星期五 下午 2-30-58.gif

You can directly copy the above code, Run the demo locally.

Here are some key attributes:

  • The text-transform attribute controls the case of text.

  • The animation property is a shorthand property:

1

2

3

4

5

6

animation-name:规定需要绑定到选择器的 keyframe 名称。。   

animation-duration:规定完成动画所花费的时间,以秒或毫秒计。   

animation-timing-function:规定动画的速度曲线。   

animation-delay:规定在动画开始之前的延迟。   

animation-iteration-count:规定动画应该播放的次数。   

animation-direction:规定是否应该轮流反向播放动画。

Copy after login
  • Animation can be created through @keyframes rules.

1

2

3

4

5

6

7

8

语法:@keyframes animationname {keyframes-selector {css-styles;}}

参数animationname必需:定义动画的名称。

参数keyframes-selector必需:动画时长的百分比。

合法的值:

0-100%

from(与 0% 相同)

to(与 100% 相同)

参数css-styles必需:一个或多个合法的 CSS 样式属性。

Copy after login

PHP Chinese website platform has a lot of video teaching resources. Welcome everyone to learn "css Video Tutorial"!

The above is the detailed content of Make interesting dynamic wavy lines of text with HTML/CSS. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1268
29
C# Tutorial
1248
24
How to use bootstrap in vue How to use bootstrap in vue Apr 07, 2025 pm 11:33 PM

Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

Understanding HTML, CSS, and JavaScript: A Beginner's Guide Understanding HTML, CSS, and JavaScript: A Beginner's Guide Apr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

The Roles of HTML, CSS, and JavaScript: Core Responsibilities The Roles of HTML, CSS, and JavaScript: Core Responsibilities Apr 08, 2025 pm 07:05 PM

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

React's Role in HTML: Enhancing User Experience React's Role in HTML: Enhancing User Experience Apr 09, 2025 am 12:11 AM

React combines JSX and HTML to improve user experience. 1) JSX embeds HTML to make development more intuitive. 2) The virtual DOM mechanism optimizes performance and reduces DOM operations. 3) Component-based management UI to improve maintainability. 4) State management and event processing enhance interactivity.

How to insert pictures on bootstrap How to insert pictures on bootstrap Apr 07, 2025 pm 03:30 PM

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

How to write split lines on bootstrap How to write split lines on bootstrap Apr 07, 2025 pm 03:12 PM

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

How to set up the framework for bootstrap How to set up the framework for bootstrap Apr 07, 2025 pm 03:27 PM

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

How to resize bootstrap How to resize bootstrap Apr 07, 2025 pm 03:18 PM

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-

See all articles