freeCodeCamp/curriculum/challenges/arabic/01-responsive-web-design/applied-visual-design/use-css-animation-to-change...

2.5 KiB
Raw Blame History

id title challengeType videoUrl localeTitle
587d78a7367417b2b2512ae0 Use CSS Animation to Change the Hover State of a Button 0 استخدم CSS Animation لتغيير حالة Hover لزر

Description

يمكنك استخدام @keyframes لتغيير لون زر في حالة التمرير الخاصة به. في ما يلي مثال على تغيير عرض الصورة على مؤشر الماوس:
<نمط>
img: hover {
اسم الرسوم المتحركة: العرض ؛
مدة الحركة: 500 مللي ثانية ؛
}

keyframes width {
100٪ {
العرض: 40 بكسل
}
}
</ النمط>

<img src = "https://bit.ly/smallgooglelogo" alt = "شعار Google" />

Instructions

لاحظ أن ms يقف للمللي ثانية ، حيث 1000ms تساوي 1s. استخدم @keyframes لتغيير background-color عنصر button بحيث يصبح #4791d0 عندما #4791d0 المستخدم فوقها. يجب أن يكون لقاعدة @keyframes إدخال 100% .

Tests

tests:
  - text: يجب أن تستخدم قاعدةkeyframes لون خلفية <code>animation-name</code> .
    testString: 'assert(code.match(/@keyframes\s+?background-color\s*?{/g), "The @keyframes rule should use the <code>animation-name</code> background-color.");'
  - text: 'يجب أن تكون هناك قاعدة واحدة تحت <code>@keyframes</code> تغير <code>background-color</code> إلى <code>#4791d0</code> بنسبة 100٪.'
    testString: 'assert(code.match(/100%\s*?{\s*?background-color:\s*?#4791d0;\s*?}/gi), "There should be one rule under <code>@keyframes</code> that changes the <code>background-color</code> to <code>#4791d0</code> at 100%.");'

Challenge Seed

<style>
  button {
    border-radius: 5px;
    color: white;
    background-color: #0F5897;
    padding: 5px 10px 8px 10px;
  }

  button:hover {
    animation-name: background-color;
    animation-duration: 500ms;
  }


</style>

<button>Register</button>

Solution

// solution required