VDone Demo VDone Demo
Home
  • Articles

    • JavaScript
  • Study Notes

    • JavaScript Tutorial
    • Professional JavaScript
    • ES6 Tutorial
    • Vue
    • React
    • TypeScript: Build Axios from Scratch
    • Git
    • TypeScript
    • JS Design Patterns
  • HTML
  • CSS
  • Technical Docs
  • GitHub Tips
  • Node.js
  • Blog Setup
  • Learning
  • Interviews
  • Miscellaneous
  • Practical Tips
  • Friends
About
Bookmarks
  • Categories
  • Tags
  • Archives
GitHub (opens new window)

Nikolay Tuzov

Backend Developer
Home
  • Articles

    • JavaScript
  • Study Notes

    • JavaScript Tutorial
    • Professional JavaScript
    • ES6 Tutorial
    • Vue
    • React
    • TypeScript: Build Axios from Scratch
    • Git
    • TypeScript
    • JS Design Patterns
  • HTML
  • CSS
  • Technical Docs
  • GitHub Tips
  • Node.js
  • Blog Setup
  • Learning
  • Interviews
  • Miscellaneous
  • Practical Tips
  • Friends
About
Bookmarks
  • Categories
  • Tags
  • Archives
GitHub (opens new window)
  • HTML

  • CSS

    • CSS Tutorials and Tips Collection
    • Flex Layout Syntax
    • Flex Layout Example - Basics
    • Flex Layout Example - Dice
    • Flex Layout Example - Holy Grail Layout
    • Flex Layout Example - Grid Layout
    • Flex Layout Example - Input Layout
    • CSS3 Transition
    • CSS3 Animation
    • Layout Tip - Auto-Expand Element Height Before Images Load
    • Text Overflow Ellipsis for Single and Multiple Lines
    • Understanding the Box Model Through the box-sizing Property
    • Horizontal and Vertical Centering Methods - Examples
    • How to Automatically Respond to CSS Dark Mode Based on System Theme
    • CSS Trick - Custom Hover Tooltips with :hover and attr()
    • CSS Functions Summary
    • Adding a Scrollbar to a Table's tbody with CSS
    • Animations in Grid Layout
  • 页面
  • CSS
xugaoyi
2019-12-25

CSS3 Transition

# CSS3 Transition

HTML structure

<div class="box1">  
  <div class="div1"></div>
  <div class="div2"></div>
  <div class="div3"></div>
</div>
1
2
3
4
5

First, set a transition on the element, specifying the style and duration. Here, all styles are set to use a 0.3s transition

.box1>div{
  /* Add transition animation to all changes on the element; you can also specify a single property */
  transition: all .3s;
}
1
2
3
4

Hover over the elements to test the effects

Width transition
.div1:hover{width: 150px;}
1

Background color transition

.div2:hover{background: #999;}
1

Bezier curve transition

/* Bezier curve transition */
.div3{transition-timing-function: cubic-bezier(.39,.62,.74,1.39)}
.div3:hover{transform: translate3d(-25px, -25px, 0)}
1
2
3

# Bezier Curve cubic-bezier(x1,y1,x2,y2)

By adjusting the Bezier curve, you can create various animation effects, such as bounce effects. The X-axis range is 0~1; the Y-axis range is not strictly defined, but should not be too large. For example: linear, i.e., cubic-bezier(0,0,1,1)

Bezier curve online tool: https://cubic-bezier.com/#.17,.67,.83,.67

Reference: https://www.w3school.com.cn/css3/index.asp

Edit (opens new window)
Last Updated: 2026/03/21, 12:14:36
Flex Layout Example - Input Layout
CSS3 Animation

← Flex Layout Example - Input Layout CSS3 Animation→

Recent Updates
01
How I Discovered Disposable Email — A True Story
06-12
02
Animations in Grid Layout
09-15
03
Renaming a Git Branch
08-11
More Articles >
Theme by VDone | Copyright © 2026-2026 Nikolay Tuzov | MIT License | Telegram
  • Auto
  • Light Mode
  • Dark Mode
  • Reading Mode