2018-10-10 18:03:03 -04:00
---
id: 58a7a6ebf9a6318348e2d5aa
title: Modify Fill Mode of an Animation
challengeType: 0
2019-08-28 16:26:13 +03:00
videoUrl: https://scrimba.com/c/cVJDmcE
forumTopicId: 301064
2018-10-10 18:03:03 -04:00
localeTitle: Изменить режим заполнения анимации
---
## Description
2019-08-28 16:26:13 +03:00
<section id='description'>
Это здорово, но пока это не работает. Обратите внимание, как сбрасывается анимация после <code>500ms</code> , и кнопка возвращается к исходному цвету. Вы хотите, чтобы кнопка оставалась подсвеченной. Это можно сделать, установив свойство <code>animation-fill-mode</code> <code>forwards</code> . Режим <code>animation-fill-mode</code> задает стиль, применяемый к элементу, когда анимация завершена. Вы можете установить е г о так: <code>animation-fill-mode: forwards;</code>
</section>
2018-10-10 18:03:03 -04:00
## Instructions
2019-08-28 16:26:13 +03:00
<section id='instructions'>
Задайте свойство <code>animation-fill-mode</code> <code>button:hover</code> <code>forwards</code> чтобы кнопка оставалась выделенной, когда пользователь наводил на нее курсор.
</section>
2018-10-10 18:03:03 -04:00
## Tests
<section id='tests'>
```yml
tests:
2019-08-28 16:26:13 +03:00
- text: <code>button:hover</code> should have a <code>animation-fill-mode</code> property with a value of <code>forwards</code>.
testString: assert(code.match(/button\s*?:\s*?hover\s*?{[\s\S]*animation-fill-mode\s*?:\s*?forwards\s*?;[\s\S]*}/gi) && code.match(/button\s*?:\s*?hover\s*?{[\s\S]*animation-name\s*?:\s*?background-color\s*?;[\s\S]*}/gi) && code.match(/button\s*?:\s*?hover\s*?{[\s\S]*animation-duration\s*?:\s*?500ms\s*?;[\s\S]*}/gi));
2018-10-10 18:03:03 -04:00
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
```html
<style>
button {
border-radius: 5px;
color: white;
background-color: #0F5897 ;
padding: 5px 10px 8px 10px;
}
button:hover {
animation-name: background-color;
animation-duration: 500ms;
/* add your code below this line */
/* add your code above this line */
}
@keyframes background-color {
100% {
background-color: #4791d0 ;
}
}
</style>
<button>Register</button>
```
</div>
</section>
## Solution
<section id='solution'>
2019-08-28 16:26:13 +03:00
```html
<style>
button {
border-radius: 5px;
color: white;
background-color: #0F5897 ;
padding: 5px 10px 8px 10px;
}
button:hover {
animation-name: background-color;
animation-duration: 500ms;
animation-fill-mode: forwards;
}
@keyframes background-color {
100% {
background-color: #4791d0 ;
}
}
</style>
<button>Register</button>
2018-10-10 18:03:03 -04:00
```
2019-08-28 16:26:13 +03:00
2018-10-10 18:03:03 -04:00
</section>