Course Content
CSS Basic
0/1
CSS Selectors
0/1
CSS Comments
0/1
CSS Backgrounds
0/1
CSS Borders
0/1
CSS Outline
0/1
CSS Fonts
0/1
CSS Height and Width
0/1
CSS Margins and Paddings
0/2
CSS Icons
0/1
CSS Links
0/1
CSS Lists
0/1
CSS Tables
0/1
CSS Display Properties
0/1
CSS Max-Width Property
0/1
CSS Positioning Elements
0/1
CSS Z-Index Property
0/1
CSS Overflow
0/1
CSS Float
0/1
CSS Opacity
0/1
CSS Forms
0/1
CSS Dropdowns
0/1
CSS Buttons
0/1
CSS Media Queries
0/1
About Lesson

In CSS, there are several transition properties that allow you to control different aspects of how transitions are applied to elements. These properties define the duration, timing function, delay, and other characteristics of CSS transitions.

Specifies the CSS property you want to apply the transition effect to.

transition-property: property1, property2, ...;
HTML
<!DOCTYPE html>
<html lang="en">
<head>
       
    <meta charset="UTF-8">
       
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Transition Property</title>
</head>

<body>
    <button>Transition-property</button>
</body>


</html>
CSS
/* Apply a transition to the background color of a button */
button {
  background-color: blue;
  transition-property: background-color;
}

/* When hovered, change the background color */
button:hover {
  background-color: red;
}

Specifies the duration over which the transition should occur. It’s specified in seconds (s) or milliseconds (ms).

HTML
<!DOCTYPE html>
<html lang="en">

<head>
       
    <meta charset="UTF-8">
       
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Transition Property</title>
</head>

<body>
    <button>Transition-property</button>
</body>


</html>
CSS
button {
        background-color: blue;
        transition-property: background-color; 
        transition-duration: 5s;
        }

Specifies the speed curve of the transition effect. It defines how the intermediate values of the CSS property are calculated over time. Common timing functions include ease, linear, ease-in, ease-out, ease-in-out, and cubic-bezier().

HTML
<!DOCTYPE html>
<html lang="en">

<head>
       
    <meta charset="UTF-8">
       
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Transition Property</title>
</head>

<body>
    <button>Transition-property</button>
</body>


</html>
CSS
button {
            background-color: blue;
            transition-property: background-color; 
            transition-duration: 1s;
            transition-timing-function: ease-in-out;
        }

Optional. Specifies a delay before the transition effect starts. It’s also specified in seconds (s) or milliseconds (ms).

HTML
<!DOCTYPE html>
<html lang="en">

<head>
       
    <meta charset="UTF-8">
       
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Transition Property</title>
</head>

<body>
    <button>Transition-property</button>
</body>


</html>
CSS
 button {
            background-color: blue;
            transition-property: background-color; 
            transition-duration: 1s;
            transition-timing-function: ease-in-out;
            transition-delay:2s;
        }

Optional. Specifies a delay before the transition effect starts. It’s also specified in seconds (s) or milliseconds (ms).

HTML
<!DOCTYPE html>
<html lang="en">

<head>
       
    <meta charset="UTF-8">
       
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Transition Property</title>
</head>

<body>
    <button>Transition-property</button>
</body>


</html>
CSS
 /* Apply a transition to the background color of a button */
        button {
            background-color: blue;
            transition: property duration timing-function delay;

        }

  /* When hovered, change the background color */
        button:hover {
            background-color: red;
        }

Using the shorthand transition property can help streamline your CSS code and make it more readable, especially when applying transitions to multiple properties on the same element.