﻿{"id":429,"date":"2026-01-22T14:33:12","date_gmt":"2026-01-22T13:33:12","guid":{"rendered":"https:\/\/lmspro.fr\/css-avance-animations-transitions-preprocesseurs-sass\/"},"modified":"2026-01-23T15:20:04","modified_gmt":"2026-01-23T14:20:04","slug":"css-avance-animations-transitions-preprocesseurs-sass","status":"publish","type":"post","link":"https:\/\/lmspro.fr\/en\/css-avance-animations-transitions-preprocesseurs-sass\/","title":{"rendered":"Advanced CSS: animations, transitions, preprocessors (Sass)"},"content":{"rendered":"<h2>Advanced CSS: animations, transitions, preprocessors (Sass)<\/h2>\n<p class=\"wpa-text\">Master advanced CSS techniques that will bring your interfaces to life! Discover how to create smooth animations, elegant transitions, and optimize your workflow with the Sass preprocessor for more maintainable and powerful stylesheets.<\/p>\n<div class=\"article-meta\">\n<p><strong>Module:<\/strong> Module 1: Technical Fundamentals of the Web<\/p>\n<p><strong>Level :<\/strong> Beginner<\/p>\n<p><strong>Duration :<\/strong> 20 minutes<\/p>\n<p><strong>Prerequisites:<\/strong> CSS basics (selectors, common properties)<\/p>\n<\/div>\n<h2>Educational objectives<\/h2>\n<ul>\n<li>Create smooth CSS animations with @keyframes and animation<\/li>\n<li>Implement elegant transitions to improve the user experience<\/li>\n<li>Use 2D and 3D transformations to enrich your interfaces<\/li>\n<li>Discover the advantages of Sass: variables, nesting, and mixins<\/li>\n<li>Organizing and maintaining complex stylesheets with a preprocessor<\/li>\n<\/ul>\n<div class=\"wpa-accordion wpa-accordion-flush\" id=\"accordion-css-avance-animations-transitions-preprocesseurs-sass\">\n<div class=\"wpa-accordion-item\">\n<button class=\"wpa-accordion-header\" data-wpa-target=\"#accordion-css-avance-animations-transitions-preprocesseurs-sass-item-1\" aria-expanded=\"false\"><span class=\"wpa-accordion-title\"><span class=\"wpa-accordion-number\">01<\/span> CSS transitions for a smooth experience<\/span><span class=\"wpa-accordion-icon\"><\/span><\/button><\/p>\n<div id=\"accordion-css-avance-animations-transitions-preprocesseurs-sass-item-1\" class=\"wpa-accordion-body\">\n<div class=\"wpa-accordion-content\">\n<h4>Understanding the principle of transitions<\/h4>\n<p>CSS transitions allow you to create smooth state changes between two CSS property values. Rather than an abrupt change on hover or during interaction, the transition creates an automatic animation that greatly improves the user experience. Transitions apply to properties that can be numerically interpolated: colors, dimensions, positions, opacity, etc.<\/p>\n<h4>Essential properties of transitions<\/h4>\n<p>The property <strong>transition<\/strong> It accepts four values: the property to animate, the duration, the timing function (ease, linear, ease-in-out), and the delay. For example, <code>transition: all 0.3s ease-in-out;<\/code> will animate all modified properties over 0.3 seconds with a smooth acceleration curve. You can target specific properties such as <code>transition: background-color 0.2s, transform 0.4s;<\/code> for more precise control.<\/p>\n<div class=\"info-box\">\n<p><strong>Key point<\/strong> Transitions only work when an element&#039;s state changes (hover, focus, class added via JavaScript). They do not trigger automatically on load.<\/p>\n<\/div>\n<div class=\"tuto-objectif\" style=\"background: #f5f5f5;border-left: 4px solid #667eea;padding: 16px 20px;margin-top: 24px;border-radius: 0 8px 8px 0\">\n<h3 style=\"color: #667eea;margin: 0 0 8px 0;font-size: 16px\">Key points to remember<\/h3>\n<p style=\"margin: 0;color: #333\">CSS transitions create smooth animations between two states by interpolating property values over a defined duration.<\/p>\n<\/div>\n<div class=\"tuto-exercise\" style=\"background: #fff3e0;border-left: 4px solid #ff9800;padding: 16px 20px;margin-top: 20px;border-radius: 0 8px 8px 0\">\n<h4 style=\"color: #ff9800;margin: 0 0 8px 0;font-size: 15px\">\ud83c\udfaf Mini-exercise: Create a color transition on hover<\/h4>\n<p style=\"margin: 0;color: #333;font-size: 14px\">Create a button that smoothly changes background color when you hover over it.<\/p>\n<\/div>\n<div class=\"codepen-block\" data-block-id=\"exercise-1\">\n<p class=\"codepen-block-label\">Reference code:<\/p>\n<div class=\"codepen-header\">\n<div class=\"codepen-tabs\">\n<button class=\"codepen-tab active\" data-tab=\"html\">HTML<\/button><br \/>\n<button class=\"codepen-tab\" data-tab=\"css\">CSS<\/button>\n<\/div>\n<p><button class=\"codepen-copy-btn\">Copy<\/button>\n<\/div>\n<div class=\"codepen-code-container\">\n<pre class=\"codepen-code active\" data-lang=\"html\"><button class=\"btn-transition\">Fly over me<\/button><\/pre>\n<pre class=\"codepen-code\" data-lang=\"css\">.btn-transition { background-color: #3498db; color:white; padding: 12px 24px; border:none; border-radius: 6px; cursor: pointer; transition: background-color 0.3s ease; } .btn-transition:hover { background-color: #e74c3c; }<\/pre>\n<\/div>\n<\/div>\n<div class=\"monaco-sandbox\" data-block-id=\"exercise-1\">\n<div class=\"monaco-header\">\n<div class=\"monaco-tabs\">\n<button class=\"monaco-tab active\" data-lang=\"html\">HTML<\/button><br \/>\n<button class=\"monaco-tab\" data-lang=\"css\">CSS<\/button>\n<\/div>\n<div class=\"monaco-actions\">\n<button class=\"monaco-btn monaco-btn-run\">\u25b6 Run<\/button><br \/>\n<button class=\"monaco-btn monaco-btn-reset\">\u21ba Reset<\/button><br \/>\n<button class=\"monaco-btn monaco-btn-save\">\ud83d\udcbe Save<\/button>\n<\/div>\n<\/div>\n<div class=\"monaco-container\">\n<div class=\"monaco-editor-wrapper\">\n<div class=\"monaco-editor-pane active\" data-lang=\"html\"><\/div>\n<div class=\"monaco-editor-pane\" data-lang=\"css\"><\/div>\n<\/div>\n<div class=\"monaco-preview-wrapper\">\n<div class=\"monaco-preview-header\">Result<\/div>\n<\/div>\n<\/div>\n<div class=\"monaco-status\">\n<span class=\"monaco-status-left\">\u25cf Ready<\/span><br \/>\n<span class=\"monaco-status-right\">Monaco Editor v0.45<\/span>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"wpa-accordion-item\">\n<button class=\"wpa-accordion-header\" data-wpa-target=\"#accordion-css-avance-animations-transitions-preprocesseurs-sass-item-2\" aria-expanded=\"false\"><span class=\"wpa-accordion-title\"><span class=\"wpa-accordion-number\">02<\/span> 2D and 3D transformations<\/span><span class=\"wpa-accordion-icon\"><\/span><\/button><\/p>\n<div id=\"accordion-css-avance-animations-transitions-preprocesseurs-sass-item-2\" class=\"wpa-accordion-body\">\n<div class=\"wpa-accordion-content\">\n<h4>Essential 2D Transformations<\/h4>\n<p>The property <strong>transform<\/strong> allows you to modify the geometry of an element without affecting the document flow. 2D functions include <code>translate()<\/code> to move, <code>scale()<\/code> to resize, <code>rotate()<\/code> to rotate, and <code>skew()<\/code> to tilt. These transformations can be combined: <code>transform: translate(50px, 100px) scale(1.2) rotate(45deg);<\/code>. The major advantage is that these transformations are optimized by the GPU, guaranteeing smooth performance.<\/p>\n<h4>Explore 3D transformations<\/h4>\n<p>3D transformations add depth with features like <code>translateZ()<\/code>, <code>rotateX()<\/code>, <code>rotateY()<\/code> And <code>rotateZ()<\/code>. To activate the 3D context, use <code>transform-style: preserve-3d;<\/code> on the parent container. The property <code>perspective<\/code> Defines the viewing distance and the intensity of the 3D effect. The lower the value, the more pronounced the perspective effect. Combine with <code>backface-visibility: hidden;<\/code> to optimize performance during rotations.<\/p>\n<div class=\"info-box\">\n<p><strong>Key point<\/strong> The transformations do not affect the actual position of the element in the document flow. The original space remains reserved even if the element visually moves.<\/p>\n<\/div>\n<div class=\"tuto-objectif\" style=\"background: #f5f5f5;border-left: 4px solid #667eea;padding: 16px 20px;margin-top: 24px;border-radius: 0 8px 8px 0\">\n<h3 style=\"color: #667eea;margin: 0 0 8px 0;font-size: 16px\">Key points to remember<\/h3>\n<p style=\"margin: 0;color: #333\">CSS transformations allow you to move, resize, rotate and skew elements in a way that is optimized by the GPU.<\/p>\n<\/div>\n<div class=\"tuto-exercise\" style=\"background: #fff3e0;border-left: 4px solid #ff9800;padding: 16px 20px;margin-top: 20px;border-radius: 0 8px 8px 0\">\n<h4 style=\"color: #ff9800;margin: 0 0 8px 0;font-size: 15px\">\ud83c\udfaf Mini-exercise: Card with 3D rotation effect<\/h4>\n<p style=\"margin: 0;color: #333;font-size: 14px\">Create a card that rotates in 3D on hover to reveal its reverse side.<\/p>\n<\/div>\n<div class=\"codepen-block\" data-block-id=\"exercise-2\">\n<p class=\"codepen-block-label\">Reference code:<\/p>\n<div class=\"codepen-header\">\n<div class=\"codepen-tabs\">\n<button class=\"codepen-tab active\" data-tab=\"html\">HTML<\/button><br \/>\n<button class=\"codepen-tab\" data-tab=\"css\">CSS<\/button>\n<\/div>\n<p><button class=\"codepen-copy-btn\">Copy<\/button>\n<\/div>\n<div class=\"codepen-code-container\">\n<pre class=\"codepen-code active\" data-lang=\"html\">&lt;div class=&quot;card-3d&quot;&gt;\n  &lt;div class=&quot;card-front&quot;&gt;Front&lt;\/div&gt;\n  &lt;div class=&quot;card-back&quot;&gt;Back&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n<pre class=\"codepen-code\" data-lang=\"css\">.card-3d { width: 200px; height: 120px; perspective: 1000px; margin: 50px; } .card-front, .card-back { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display:flex; align-items: center; justify-content: center; border-radius: 10px; font-weight: bold; color:white; transition: transform 0.6s; } .card-front { background: #3498db; } .card-back { background: #e74c3c; transform: rotateY(180deg); } .card-3d:hover .card-front { transform: rotateY(-180deg); } .card-3d:hover .card-back { transform: rotateY(0); }<\/pre>\n<\/div>\n<\/div>\n<div class=\"monaco-sandbox\" data-block-id=\"exercise-2\">\n<div class=\"monaco-header\">\n<div class=\"monaco-tabs\">\n<button class=\"monaco-tab active\" data-lang=\"html\">HTML<\/button><br \/>\n<button class=\"monaco-tab\" data-lang=\"css\">CSS<\/button>\n<\/div>\n<div class=\"monaco-actions\">\n<button class=\"monaco-btn monaco-btn-run\">\u25b6 Run<\/button><br \/>\n<button class=\"monaco-btn monaco-btn-reset\">\u21ba Reset<\/button><br \/>\n<button class=\"monaco-btn monaco-btn-save\">\ud83d\udcbe Save<\/button>\n<\/div>\n<\/div>\n<div class=\"monaco-container\">\n<div class=\"monaco-editor-wrapper\">\n<div class=\"monaco-editor-pane active\" data-lang=\"html\"><\/div>\n<div class=\"monaco-editor-pane\" data-lang=\"css\"><\/div>\n<\/div>\n<div class=\"monaco-preview-wrapper\">\n<div class=\"monaco-preview-header\">Result<\/div>\n<\/div>\n<\/div>\n<div class=\"monaco-status\">\n<span class=\"monaco-status-left\">\u25cf Ready<\/span><br \/>\n<span class=\"monaco-status-right\">Monaco Editor v0.45<\/span>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"wpa-accordion-item\">\n<button class=\"wpa-accordion-header\" data-wpa-target=\"#accordion-css-avance-animations-transitions-preprocesseurs-sass-item-3\" aria-expanded=\"false\"><span class=\"wpa-accordion-title\"><span class=\"wpa-accordion-number\">03<\/span> CSS animations with @keyframes<\/span><span class=\"wpa-accordion-icon\"><\/span><\/button><\/p>\n<div id=\"accordion-css-avance-animations-transitions-preprocesseurs-sass-item-3\" class=\"wpa-accordion-body\">\n<div class=\"wpa-accordion-content\">\n<h4>Define an animation using @keyframes<\/h4>\n<p>Unlike transitions, which require a trigger, CSS animations are self-contained and can start automatically. They use the rule <strong>@keyframes<\/strong> to define the animation steps. Each step can be defined with percentages (0%, 50%, 100%) or the keywords &quot;from&quot; and &quot;to&quot;. Within each keyframe, you define the CSS properties and their values. The browser automatically interpolates the values between each step, creating smooth movement.<\/p>\n<h4>Animation control properties<\/h4>\n<p>The property <strong>animation<\/strong> combines several sub-properties: <code>animation-name<\/code> (name of the @keyframes), <code>animation-duration<\/code> (duration), <code>animation-timing-function<\/code> (animation curve), <code>animation-delay<\/code> (deadline), <code>animation-iteration-count<\/code> (number of repetitions), <code>animation-direction<\/code> (reading direction), and <code>animation-fill-mode<\/code> (before\/after state). For example: <code>animation: slideIn 2s ease-out 0.5s infinite alternate both;<\/code> will create a 2-second animation named &quot;slideIn&quot;, with a 0.5s delay, repeated infinitely alternately.<\/p>\n<div class=\"info-box\">\n<p><strong>Key point<\/strong> CSS animations are more efficient than JavaScript animations because they can be optimized by the browser and delegated to the GPU.<\/p>\n<\/div>\n<div class=\"tuto-objectif\" style=\"background: #f5f5f5;border-left: 4px solid #667eea;padding: 16px 20px;margin-top: 24px;border-radius: 0 8px 8px 0\">\n<h3 style=\"color: #667eea;margin: 0 0 8px 0;font-size: 16px\">Key points to remember<\/h3>\n<p style=\"margin: 0;color: #333\">@keyframes animations allow you to create complex, self-contained animation sequences with precise control over timing and repetitions.<\/p>\n<\/div>\n<div class=\"tuto-exercise\" style=\"background: #fff3e0;border-left: 4px solid #ff9800;padding: 16px 20px;margin-top: 20px;border-radius: 0 8px 8px 0\">\n<h4 style=\"color: #ff9800;margin: 0 0 8px 0;font-size: 15px\">\ud83c\udfaf Mini-exercise: Infinite pulse animation<\/h4>\n<p style=\"margin: 0;color: #333;font-size: 14px\">Create an element that pulses by changing size continuously and repetitively.<\/p>\n<\/div>\n<div class=\"codepen-block\" data-block-id=\"exercise-3\">\n<p class=\"codepen-block-label\">Reference code:<\/p>\n<div class=\"codepen-header\">\n<div class=\"codepen-tabs\">\n<button class=\"codepen-tab active\" data-tab=\"html\">HTML<\/button><br \/>\n<button class=\"codepen-tab\" data-tab=\"css\">CSS<\/button>\n<\/div>\n<p><button class=\"codepen-copy-btn\">Copy<\/button>\n<\/div>\n<div class=\"codepen-code-container\">\n<pre class=\"codepen-code active\" data-lang=\"html\">&lt;div class=&quot;pulse-circle&quot;&gt;&lt;\/div&gt;<\/pre>\n<pre class=\"codepen-code\" data-lang=\"css\">@keyframes pulse { 0% { transform: scale(1); background-color: #3498db; } 50% { transform: scale(1.3); background-color: #e74c3c; } 100% { transform: scale(1); background-color: #3498db; } } .pulse-circle { width: 80px; height: 80px; background-color: #3498db; border-radius: 50%; margin: 50px auto; animation: pulse 2s infinite ease-in-out; }<\/pre>\n<\/div>\n<\/div>\n<div class=\"monaco-sandbox\" data-block-id=\"exercise-3\">\n<div class=\"monaco-header\">\n<div class=\"monaco-tabs\">\n<button class=\"monaco-tab active\" data-lang=\"html\">HTML<\/button><br \/>\n<button class=\"monaco-tab\" data-lang=\"css\">CSS<\/button>\n<\/div>\n<div class=\"monaco-actions\">\n<button class=\"monaco-btn monaco-btn-run\">\u25b6 Run<\/button><br \/>\n<button class=\"monaco-btn monaco-btn-reset\">\u21ba Reset<\/button><br \/>\n<button class=\"monaco-btn monaco-btn-save\">\ud83d\udcbe Save<\/button>\n<\/div>\n<\/div>\n<div class=\"monaco-container\">\n<div class=\"monaco-editor-wrapper\">\n<div class=\"monaco-editor-pane active\" data-lang=\"html\"><\/div>\n<div class=\"monaco-editor-pane\" data-lang=\"css\"><\/div>\n<\/div>\n<div class=\"monaco-preview-wrapper\">\n<div class=\"monaco-preview-header\">Result<\/div>\n<\/div>\n<\/div>\n<div class=\"monaco-status\">\n<span class=\"monaco-status-left\">\u25cf Ready<\/span><br \/>\n<span class=\"monaco-status-right\">Monaco Editor v0.45<\/span>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"wpa-accordion-item\">\n<button class=\"wpa-accordion-header\" data-wpa-target=\"#accordion-css-avance-animations-transitions-preprocesseurs-sass-item-4\" aria-expanded=\"false\"><span class=\"wpa-accordion-title\"><span class=\"wpa-accordion-number\">04<\/span> Introduction to Sass: variables and nesting<\/span><span class=\"wpa-accordion-icon\"><\/span><\/button><\/p>\n<div id=\"accordion-css-avance-animations-transitions-preprocesseurs-sass-item-4\" class=\"wpa-accordion-body\">\n<div class=\"wpa-accordion-content\">\n<h4>Why use a CSS preprocessor?<\/h4>\n<p><strong>Sass (Syntactically Awesome Stylesheets)<\/strong> Sass is a preprocessor that extends the capabilities of CSS by adding programming features. It allows you to write more maintainable, reusable, and organized code. Sass compiles to standard CSS, compatible with all browsers. The two main syntaxes are SCSS (similar to CSS with curly braces) and indented Sass (without curly braces or semicolons). SCSS is generally preferred because it is closer to classic CSS.<\/p>\n<h4>Variables and nesting<\/h4>\n<p>THE <strong>Sass variables<\/strong> begin with the symbol <code>$<\/code> and allow for the storage of reusable values: colors, fonts, dimensions. Example: <code>$primary-color: #3498db;<\/code>. THE <strong>nesting<\/strong> allows selectors to be nested, reflecting the HTML structure and improving readability. The operator <code>&amp;<\/code> refers to the parent selector, useful for pseudo-classes: <code>&amp;:hover<\/code>. Be careful not to overuse nesting (maximum 3-4 levels) to avoid excessive CSS specificity.<\/p>\n<div class=\"info-box\">\n<p><strong>Key point<\/strong> Sass must be compiled into CSS to be used in the browser. Many tools like Node-sass, Dart Sass, or bundlers handle this compilation automatically.<\/p>\n<\/div>\n<div class=\"tuto-objectif\" style=\"background: #f5f5f5;border-left: 4px solid #667eea;padding: 16px 20px;margin-top: 24px;border-radius: 0 8px 8px 0\">\n<h3 style=\"color: #667eea;margin: 0 0 8px 0;font-size: 16px\">Key points to remember<\/h3>\n<p style=\"margin: 0;color: #333\">Sass improves CSS with variables for reusability and nesting for a clearer and maintainable structure.<\/p>\n<\/div>\n<div class=\"tuto-exercise\" style=\"background: #fff3e0;border-left: 4px solid #ff9800;padding: 16px 20px;margin-top: 20px;border-radius: 0 8px 8px 0\">\n<h4 style=\"color: #ff9800;margin: 0 0 8px 0;font-size: 15px\">\ud83c\udfaf Mini-exercise: Using Sass variables<\/h4>\n<p style=\"margin: 0;color: #333;font-size: 14px\">Create a color theme with Sass variables and use nesting to style a button.<\/p>\n<\/div>\n<div class=\"codepen-block\" data-block-id=\"exercise-4\">\n<p class=\"codepen-block-label\">Reference code:<\/p>\n<div class=\"codepen-header\">\n<div class=\"codepen-tabs\">\n<button class=\"codepen-tab active\" data-tab=\"html\">HTML<\/button><br \/>\n<button class=\"codepen-tab\" data-tab=\"css\">CSS<\/button>\n<\/div>\n<p><button class=\"codepen-copy-btn\">Copy<\/button>\n<\/div>\n<div class=\"codepen-code-container\">\n<pre class=\"codepen-code active\" data-lang=\"html\"><button class=\"btn-sass\">Sass button<\/button><\/pre>\n<pre class=\"codepen-code\" data-lang=\"css\">\/* Sass variables *\/ $primary-color: #3498db; $hover-color: #2980b9; $text-color: white; $border-radius: 8px; $padding: 12px 24px; \/* Nesting Sass *\/ .btn-sass { background-color: $primary-color; color: $text-color; padding: $padding; border:none; border-radius: $border-radius; cursor: pointer; transition: all 0.3s ease; &amp;:hover { background-color: $hover-color; transform: translateY(-2px); } &amp;:active { transform: translateY(0); } }<\/pre>\n<\/div>\n<\/div>\n<div class=\"monaco-sandbox\" data-block-id=\"exercise-4\">\n<div class=\"monaco-header\">\n<div class=\"monaco-tabs\">\n<button class=\"monaco-tab active\" data-lang=\"html\">HTML<\/button><br \/>\n<button class=\"monaco-tab\" data-lang=\"css\">CSS<\/button>\n<\/div>\n<div class=\"monaco-actions\">\n<button class=\"monaco-btn monaco-btn-run\">\u25b6 Run<\/button><br \/>\n<button class=\"monaco-btn monaco-btn-reset\">\u21ba Reset<\/button><br \/>\n<button class=\"monaco-btn monaco-btn-save\">\ud83d\udcbe Save<\/button>\n<\/div>\n<\/div>\n<div class=\"monaco-container\">\n<div class=\"monaco-editor-wrapper\">\n<div class=\"monaco-editor-pane active\" data-lang=\"html\"><\/div>\n<div class=\"monaco-editor-pane\" data-lang=\"css\"><\/div>\n<\/div>\n<div class=\"monaco-preview-wrapper\">\n<div class=\"monaco-preview-header\">Result<\/div>\n<\/div>\n<\/div>\n<div class=\"monaco-status\">\n<span class=\"monaco-status-left\">\u25cf Ready<\/span><br \/>\n<span class=\"monaco-status-right\">Monaco Editor v0.45<\/span>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"wpa-accordion-item\">\n<button class=\"wpa-accordion-header\" data-wpa-target=\"#accordion-css-avance-animations-transitions-preprocesseurs-sass-item-5\" aria-expanded=\"false\"><span class=\"wpa-accordion-title\"><span class=\"wpa-accordion-number\">05<\/span> Sass Mixins and Functions for Reusability<\/span><span class=\"wpa-accordion-icon\"><\/span><\/button><\/p>\n<div id=\"accordion-css-avance-animations-transitions-preprocesseurs-sass-item-5\" class=\"wpa-accordion-body\">\n<div class=\"wpa-accordion-content\">\n<h4>Create and use mixins<\/h4>\n<p>THE <strong>mixins<\/strong> are reusable CSS code blocks defined with <code>@mixin<\/code> and called with <code>@include<\/code>. They can accept parameters for greater flexibility. For example, a mixin for the buttons: <code>@mixin button-style($bg-color, $text-color: white) { ... }<\/code>. Mixins are perfect for vendor prefixes, complex patterns (flexbox centering, gradients), or repetitive media queries. They reduce code duplication and facilitate maintenance by centralizing common styles.<\/p>\n<h4>Sass Functions and Operations<\/h4>\n<p>Sass offers <strong>integrated functions<\/strong> to manipulate colors (<code>lighten()<\/code>, <code>darken()<\/code>, <code>mix()<\/code>), strings, numbers, and lists. You can create your own functions with <code>@function<\/code>. Mathematical operations (+, -, *, \/, %) allow for dynamic calculations. Conditional functions <code>@if<\/code>, <code>@else<\/code> and the loops <code>@for<\/code>, <code>@each<\/code> They add programmable logic. This power allows for the automatic generation of complex CSS.<\/p>\n<div class=\"info-box\">\n<p><strong>Key point<\/strong> Mixins generate CSS with each use, while inheritance with @extend shares the same selector. Choose according to the context to optimize the size of the final CSS.<\/p>\n<\/div>\n<div class=\"tuto-objectif\" style=\"background: #f5f5f5;border-left: 4px solid #667eea;padding: 16px 20px;margin-top: 24px;border-radius: 0 8px 8px 0\">\n<h3 style=\"color: #667eea;margin: 0 0 8px 0;font-size: 16px\">Key points to remember<\/h3>\n<p style=\"margin: 0;color: #333\">Sass mixins and functions allow you to create modular and reusable code with customizable parameters and dynamic operations.<\/p>\n<\/div>\n<div class=\"tuto-exercise\" style=\"background: #fff3e0;border-left: 4px solid #ff9800;padding: 16px 20px;margin-top: 20px;border-radius: 0 8px 8px 0\">\n<h4 style=\"color: #ff9800;margin: 0 0 8px 0;font-size: 15px\">\ud83c\udfaf Mini-exercise: Create a mixin to center the elements<\/h4>\n<p style=\"margin: 0;color: #333;font-size: 14px\">Develop a reusable flexbox mixin to center elements horizontally and vertically.<\/p>\n<\/div>\n<div class=\"codepen-block\" data-block-id=\"exercise-5\">\n<p class=\"codepen-block-label\">Reference code:<\/p>\n<div class=\"codepen-header\">\n<div class=\"codepen-tabs\">\n<button class=\"codepen-tab active\" data-tab=\"html\">HTML<\/button><br \/>\n<button class=\"codepen-tab\" data-tab=\"css\">CSS<\/button>\n<\/div>\n<p><button class=\"codepen-copy-btn\">Copy<\/button>\n<\/div>\n<div class=\"codepen-code-container\">\n<pre class=\"codepen-code active\" data-lang=\"html\">&lt;div class=&quot;container&quot;&gt;\n  &lt;div class=&quot;centered-box&quot;&gt;Center !&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n<pre class=\"codepen-code\" data-lang=\"css\">\/* Mixin to center elements *\/ @mixin flex-center($direction: row) { display: flex; justify-content: center; align-items: center; flex-direction: $direction; } \/* Function to calculate responsive sizes *\/ @function rem-calc($px) { @return $px \/ 16 * 1rem; } .container { @include flex-center(); height: 200px; background-color: #ecf0f1; } .centered-box { width: rem-calc(120); height: rem-calc(80); background-color: #3498db; color:white; @include flex-center(); border-radius: rem-calc(8); font-weight: bold; }<\/pre>\n<\/div>\n<\/div>\n<div class=\"monaco-sandbox\" data-block-id=\"exercise-5\">\n<div class=\"monaco-header\">\n<div class=\"monaco-tabs\">\n<button class=\"monaco-tab active\" data-lang=\"html\">HTML<\/button><br \/>\n<button class=\"monaco-tab\" data-lang=\"css\">CSS<\/button>\n<\/div>\n<div class=\"monaco-actions\">\n<button class=\"monaco-btn monaco-btn-run\">\u25b6 Run<\/button><br \/>\n<button class=\"monaco-btn monaco-btn-reset\">\u21ba Reset<\/button><br \/>\n<button class=\"monaco-btn monaco-btn-save\">\ud83d\udcbe Save<\/button>\n<\/div>\n<\/div>\n<div class=\"monaco-container\">\n<div class=\"monaco-editor-wrapper\">\n<div class=\"monaco-editor-pane active\" data-lang=\"html\"><\/div>\n<div class=\"monaco-editor-pane\" data-lang=\"css\"><\/div>\n<\/div>\n<div class=\"monaco-preview-wrapper\">\n<div class=\"monaco-preview-header\">Result<\/div>\n<\/div>\n<\/div>\n<div class=\"monaco-status\">\n<span class=\"monaco-status-left\">\u25cf Ready<\/span><br \/>\n<span class=\"monaco-status-right\">Monaco Editor v0.45<\/span>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h2>Summary<\/h2>\n<div class=\"tuto-recap\" style=\"background: #f5f5f5;border-left: 4px solid #9c27b0;padding: 16px 20px;border-radius: 0 8px 8px 0\">\n<h3 style=\"color: #9c27b0;margin: 0 0 12px 0;font-size: 16px\">Key points to remember<\/h3>\n<ul style=\"margin: 0;padding-left: 20px;color: #333\">\n<li><strong>CSS Transitions<\/strong> Create smooth animations between two element states using duration, timing-function, and delay.<\/li>\n<li><strong>2D\/3D Transformations<\/strong> : Allows you to move, resize, and rotate elements without affecting the document flow<\/li>\n<li><strong>@keyframes animations<\/strong> They define self-contained animation sequences with precise control over timing and repetitions.<\/li>\n<li><strong>Sass variables and nesting<\/strong> Improve CSS maintainability with reusable values and a clear hierarchical structure<\/li>\n<li><strong>Sass Mixins and Functions<\/strong> They offer a modular approach with reusable code blocks and advanced dynamic operations.<\/li>\n<\/ul>\n<\/div>\n<h2>Sources<\/h2>\n<div class=\"sources-box\" style=\"background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);border: 1px solid #cbd5e1;border-radius: 12px;padding: 16px;margin-bottom: 24px\">\n<p style=\"color: #64748b;margin: 0 0 12px 0;font-size: 13px\">To deepen your knowledge:<\/p>\n<ul style=\"margin: 0;padding-left: 0\">\n<li style=\"margin-bottom: 8px\">\n<a href=\"https:\/\/developer.mozilla.org\/fr\/docs\/Web\/CSS\/CSS_Animations\/Using_CSS_animations\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"align-items: center;gap: 10px;padding: 10px 14px;background: white;border-radius: 8px;text-decoration: none;color: #1e293b;border: 1px solid #e2e8f0\"><br \/>\n<span style=\"color: #94a3b8\">\ud83d\udd17<\/span><br \/>\n<span style=\"flex: 1;font-weight: 500;color: #0f172a\">MDN \u2013 Using CSS animations<\/span><br \/>\n<span style=\"color: #94a3b8\">\u2192<\/span><br \/>\n<\/a>\n<\/li>\n<li style=\"margin-bottom: 0\">\n<a href=\"https:\/\/sass-lang.com\/guide\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"align-items: center;gap: 10px;padding: 10px 14px;background: white;border-radius: 8px;text-decoration: none;color: #1e293b;border: 1px solid #e2e8f0\"><br \/>\n<span style=\"color: #94a3b8\">\ud83d\udd17<\/span><br \/>\n<span style=\"flex: 1;font-weight: 500;color: #0f172a\">Sass \u2013 Official Guide and Documentation<\/span><br \/>\n<span style=\"color: #94a3b8\">\u2192<\/span><br \/>\n<\/a>\n<\/li>\n<\/ul>\n<\/div>\n<h2>Validate your knowledge<\/h2>\n<p>Test your understanding with this 10-question quiz:<\/p>\n<div id=\"quiz-block-1\" class=\"quiz-container\" data-quiz-json=\"https:\/\/lmspro.fr\/wp-content\/plugins\/generate-article-endpoint\/quiz-data\/en\/quiz-css-avance-animations-transitions-preprocesseurs-sass.json\" aria-label=\"Interactive Quiz\"><div class=\"quiz-loading\" role=\"status\" aria-live=\"polite\"><span class=\"quiz-sr-only\">Loading quiz...<\/span><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Advanced CSS: Animations, Transitions, Preprocessors (Sass) Master advanced CSS techniques that will bring your interfaces to life! Discover how to create smooth animations, elegant transitions, and optimize your workflow with the Sass preprocessor for more maintainable and powerful stylesheets. Module: Module 1: Web Technical Fundamentals Level\u2026 <a href=\"https:\/\/lmspro.fr\/en\/css-avance-animations-transitions-preprocesseurs-sass\/\" class=\"more-link\">Read More<span class=\"screen-reader-text\"> \u00ab\u00a0CSS avanc\u00e9 : animations, transitions, pr\u00e9processeurs (Sass)\u00a0\u00bb<\/span> &raquo;<\/a><\/p>","protected":false},"author":1,"featured_media":430,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[34,25,26,132,27,28,133,2],"class_list":["post-429","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-module-1-fondamentaux-techniques-du-web","tag-accessibilite","tag-animation","tag-css","tag-fondamentaux-web","tag-html","tag-javascript","tag-js","tag-ux"],"_links":{"self":[{"href":"https:\/\/lmspro.fr\/en\/wp-json\/wp\/v2\/posts\/429","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lmspro.fr\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lmspro.fr\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lmspro.fr\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lmspro.fr\/en\/wp-json\/wp\/v2\/comments?post=429"}],"version-history":[{"count":3,"href":"https:\/\/lmspro.fr\/en\/wp-json\/wp\/v2\/posts\/429\/revisions"}],"predecessor-version":[{"id":456,"href":"https:\/\/lmspro.fr\/en\/wp-json\/wp\/v2\/posts\/429\/revisions\/456"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lmspro.fr\/en\/wp-json\/wp\/v2\/media\/430"}],"wp:attachment":[{"href":"https:\/\/lmspro.fr\/en\/wp-json\/wp\/v2\/media?parent=429"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lmspro.fr\/en\/wp-json\/wp\/v2\/categories?post=429"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lmspro.fr\/en\/wp-json\/wp\/v2\/tags?post=429"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}