2.0 KiB
2.0 KiB
id, title, challengeType, videoUrl, localeTitle
| id | title | challengeType | videoUrl | localeTitle |
|---|---|---|---|---|
| 587d78a5367417b2b2512ad6 | Create a Gradual CSS Linear Gradient | 0 | 创建渐进的CSS线性渐变 |
Description
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
tests:
- text: <code>div</code>元素应具有指定方向和颜色的<code>linear-gradient</code> <code>background</code> 。
testString: 'assert(code.match(/background:\s*?linear-gradient\(35deg,\s*?(#CCFFFF|#CFF),\s*?(#FFCCCC|#FCC)\);/gi), "The <code>div</code> element should have a <code>linear-gradient</code> <code>background</code> with the specified direction and colors.");'
Challenge Seed
<style>
div{
border-radius: 20px;
width: 70%;
height: 400px;
margin: 50px auto;
}
</style>
<div></div>
Solution
// solution required