How to implement font enlargement and reduction animation in css3
Implementation method: 1. Use the "@keyframes" rule and the "transform:scale (scale);" statement to create a font enlargement and reduction animation; 2. Use "font element {animation: animation name time infinite;} ” statement applies the scaling animation to the font element.
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
In css, you can use animation
attributes, "@keyframes
" rules, transform: scale()
to achieve font amplification Zoom out animation
Example:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> /*css部分*/ @keyframes scaleDraw { /*定义关键帧、scaleDrew是需要绑定到选择器的关键帧名称*/ 0% { transform: scale(1);/*开始为原始大小*/ } 25% { transform: scale(1.5);/*放大1.1倍*/ } 50% { transform: scale(1); } 75% { transform: scale(1.5); } } .ballon { width: 150px; height: 200px; margin: 100px auto; -webkit-animation-name: scaleDraw;/*关键帧名称*/ -webkit-animation-timing-function: ease-in-out;/*动画的速度曲线*/ -webkit-animation-iteration-count: infinite;/*动画播放的次数*/ -webkit-animation-duration: 5s;/*动画所花费的时间*/ /*可以简写为*/ /* animation: scaleDraw 5s ease-in-out infinite; */ /* -webkit-animation: scaleDraw 5s ease-in-out infinite; */ } </style> </head> <body> <div class="ballon">欢迎来到PHP中文网</div> </body> </html>
##Instructions:
animation(animation attribute)
Description | CSS | |
---|---|---|
Define an animation. The animation name defined by @keyframes is used by animation-name. | 3 | |
Composite attribute. Retrieves or sets the animation effects applied to the object. | 3 | |
Retrieve or set the animation name applied to the object, which must be used in conjunction with the rule @keyframes, because the animation name is determined by @keyframes definition | 3 | |
Retrieves or sets the duration of the object animation | 3 | |
Retrieves or sets the transition type of the object animation | 3 | |
Retrieve or set the delay time of object animation | 3 | |
Retrieve or set the loop of object animation Times | 3 | |
Retrieve or set whether the object animation moves in reverse direction in the loop | 3 | |
Retrieve or set the state of the object animation | 3 |
is a rule of CSS3 that can be used to define the behavior of a period of CSS animation and create simple animations. @keyframes rules are composed of a set of encapsulated CSS style rules that describe how attribute values change over time.
@keyframes animation-name {keyframes-selector {css-styles;}}
- keyframes-selector: Defines the percentage of animation, it is between 0% and 100%. An animation can contain many selectors.
- Then, using different CSS animation properties, you can control many different aspects of the animation, including the number of animation iterations, whether to alternate between the start and end values, and the animation Whether it should run or pause. Animations can also delay their start time.
@keyframe rules consist of the keyword "@keyframe", followed by an identifier giving the name of the animation (which will be referenced using animation-name), followed by a set of style rules (delimited by curly braces) . The animation is then applied to the element by using the identifier as the value of the animation-name attribute.
Syntax:
/* 定义动画*/ @keyframes 动画名称{ /* 样式规则*/ } /* 将它应用于元素 */ .element { animation-name: 动画名称(在@keyframes中已经声明好的); /* 或使用动画简写属性*/ animation: 动画名称 1s ... }
Inside the curly braces, we need to define keyframes or waypoints that specify the value of the property being animated at a specific point during the animation . This allows us to control intermediate steps in the animation sequence.
(Learning video sharing:
css video tutorialThe above is the detailed content of How to implement font enlargement and reduction animation in css3. For more information, please follow other related articles on the PHP Chinese website!

The article discusses HTML5 audio formats and cross-browser compatibility. It covers MP3, WAV, OGG, AAC, and WebM, and suggests using multiple sources and fallbacks for broader accessibility.

SVG and Canvas are HTML5 elements for web graphics. SVG, being vector-based, excels in scalability and interactivity, while Canvas, pixel-based, is better for performance-intensive applications like games.

HTML5 enables drag and drop with specific events and attributes, allowing customization but facing browser compatibility issues on older versions and mobile devices.

The article discusses the differences between HTML's <meter> and <progress> tags, used for displaying scalar values and task progress, respectively.

Here is the converted data into a tabular format using HTML5, including examples and strategies for responsive design, best practices for styling, and semantic HTML5 tags used within a table structure:<!DOCTYPE html> <html lang=&

The article discusses image maps in web design, their benefits like enhanced navigation and engagement, and tools for their creation.

The article discusses the differences between <datalist> and <select> tags, focusing on their functionality, user interaction, and suitability for different web development scenarios.

The article discusses the differences between HTML's <figure> and <img> tags, focusing on their purposes, usage, and semantic benefits. The main argument is that <figure> provides better structure and accessi


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 English version
Recommended: Win version, supports code prompts!

SublimeText3 Linux new version
SublimeText3 Linux latest version

Notepad++7.3.1
Easy-to-use and free code editor
