--- id: 587d78a5367417b2b2512ad6 title: Create a Gradual CSS Linear Gradient challengeType: 0 videoUrl: '' localeTitle: 创建渐进的CSS线性渐变 --- ## Description
在HTML元素上应用颜色不仅限于一个平面色调。 CSS提供了在元素上使用颜色过渡(也称为渐变)的功能。这可以通过background属性的linear-gradient()函数访问。这是一般语法: background: linear-gradient(gradient_direction, color 1, color 2, color 3, ...);第一个参数指定颜色过渡开始的方向 - 它可以表示为度,其中90deg为垂直渐变,45deg的角度为反斜杠。以下参数指定渐变中使用的颜色顺序。示例: background: linear-gradient(90deg, red, yellow, rgb(204, 204, 255));
## Instructions
div元素的background使用linear-gradient() ,并从35度的方向设置它以将颜色从#CCFFFF更改为#FFCCCC注意
虽然还有其他方法可以指定颜色值,例如rgb()hsl() ,但请为此挑战使用十六进制值。
## Tests
```yml tests: - text: div元素应具有指定方向和颜色的linear-gradient background 。 testString: 'assert(code.match(/background:\s*?linear-gradient\(35deg,\s*?(#CCFFFF|#CFF),\s*?(#FFCCCC|#FCC)\);/gi), "The div element should have a linear-gradient background with the specified direction and colors.");' ```
## Challenge Seed
```html
```
## Solution
```js // solution required ```