본문 바로가기
HTML CSS

KokoaTalk Clone Coding: transitions

by jane.dev 2021. 5. 5.
반응형

<head>

     <style>

          a {

               background-color: royalblue;

               color: lightgray;

               text-decoration: none;

               padding: 5px;

               border-radius: 5px;

               font-size: 55px;

          }

          a:hover { state

               background-color: lightgray;

               color: royalblue;

          }

     </style>

</head>

<body>

     <a href="#">Go to Website!</a>

</body>

a
a hover

 

But changing is so fast. 

 

a {

    background-color: royalblue;

    color: lightgray;

    text-decoration: none;

    padding: 5px;

    border-radius: 5px;

    font-size: 55px;

    transition: background-color 10sease-in-out; transition have to add element without state

}

1s
5s
8s
10s

The text changes immediately, the background color takes 10 seconds.

 

a {

    background-color: royalblue;

    color: lightgray;

    text-decoration: none;

    padding: 5px;

    border-radius: 5px;

    font-size: 55px;

    transition: background-color 5s ease-in-out, color 5s ease-in-out; = all 5s ease-in-out

}

 

transition is going to look for hover.

Rule 1. If you want to change anything, you have to put the 'state' somthing.

Rule 2. The transition shouldn't be in the 'state'(should be in the root element).