Files
freeCodeCamp/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-a-gradual-css-linear-gradient.chinese.md
Kristofer Koishigawa b3213fc892 fix(i18n): chinese test suite (#38220)
* fix: Chinese test suite

Add localeTiltes, descriptions, and adjust test text and testStrings to get the automated test suite working.

* fix: ran script, updated testStrings and solutions
2020-03-03 18:49:47 +05:30

1.9 KiB
Raw Blame History

id, title, challengeType, videoUrl, forumTopicId, localeTitle
id title challengeType videoUrl forumTopicId localeTitle
587d78a5367417b2b2512ad6 Create a Gradual CSS Linear Gradient 0 https://scrimba.com/c/cg4dpt9 301047 创建一个 CSS 线性渐变

Description

HTML 元素的背景色并不局限于单色。CSS 还提供了颜色过渡,也就是渐变。可以通过 background 里面的 linear-gradient() 来实现线性渐变,下面是它的语法: background: linear-gradient(gradient_direction, 颜色 1, 颜色 2, 颜色 3, ...); 第一个参数指定了颜色过渡的方向 - 它的值是角度90deg 代表垂直渐变45deg 的渐变角度和反斜杠方向差不多。剩下的参数指定了渐变颜色的顺序: 例子: background: linear-gradient(90deg, red, yellow, rgb(204, 204, 255));

Instructions

使用 linear-gradient()div 添加 background 渐变色,渐变角度 35deg#CCFFFF 过渡到 #FFCCCC注意
有很多种方式指定颜色值,如 rgb() 或者 hsl()。在本关里请使用 hex 颜色码。

Tests

tests:
  - text: '<code>div</code> 元素应该有一个指定方向和颜色的 <code>linear-gradient</code> <code>background</code>渐变色。'
    testString: assert($('div').css('background-image').match(/linear-gradient\(35deg, rgb\(204, 255, 255\), rgb\(255, 204, 204\)\)/gi));

Challenge Seed

<style>
  div{ 
    border-radius: 20px;
    width: 70%;
    height: 400px;
    margin: 50px auto;
    
  }

</style>

<div></div>

Solution

// solution required