7. CSS 2D/3D Transforms, Transitions & Animations
transform: rotate/scale/translate, transition duration, @keyframes animations & tooltips
Module 1: CSS Transitions & 2D Transforms
Change property values smoothly over a given duration.
Core Theory & Principles
- transform: translate(x, y), rotate(deg), scale(x, y), skew(x, y).
- transition: property duration timing-function delay.
- @keyframes defines custom animation keyframe steps (0% to 100%).
Practical Key Takeaways
Mastering CSS Transitions & 2D Transforms builds fundamental development capability. Review practical code and outputs carefully.
💻 Practical Code Example - CSS Transitions & 2D Transforms
<!DOCTYPE html>
<html>
<head>
<style>
.animated-box {
width: 100px;
height: 100px;
background: rgb(56, 189, 248);
color: rgb(15, 23, 42);
font-weight: bold;
display: flex;
align-items: center;
justify-content: center;
border-radius: 12px;
transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.4s;
}
.animated-box:hover {
transform: scale(1.15) rotate(5deg);
background: rgb(74, 222, 128);
}
</style>
</head>
<body>
<div class="animated-box">Hover Me</div>
</body>
</html>
📤 Expected Output / Browser Rendered Result:
Output Verified Cleanly.