* feat(tools): add seed/solution restore script * chore(curriculum): remove empty sections' markers * chore(curriculum): add seed + solution to Chinese * chore: remove old formatter * fix: update getChallenges parse translated challenges separately, without reference to the source * chore(curriculum): add dashedName to English * chore(curriculum): add dashedName to Chinese * refactor: remove unused challenge property 'name' * fix: relax dashedName requirement * fix: stray tag Remove stray `pre` tag from challenge file. Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
1.6 KiB
1.6 KiB
id, title, challengeType, videoUrl, forumTopicId, dashedName
id | title | challengeType | videoUrl | forumTopicId | dashedName |
---|---|---|---|---|---|
587d78a5367417b2b2512ad6 | 创建一个 CSS 线性渐变 | 0 | https://scrimba.com/c/cg4dpt9 | 301047 | create-a-gradual-css-linear-gradient |
--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
设置为渐变色,渐变的起始角度为 35 度,颜色从 #CCFFFF
过渡到 #FFCCCC
。
--hints--
div
元素应有一个指定方向和颜色的 linear-gradient
来设置 background
。
assert(
$('div')
.css('background-image')
.match(
/linear-gradient\(35deg, rgb\(204, 255, 255\), rgb\(255, 204, 204\)\)/gi
)
);
--seed--
--seed-contents--
<style>
div {
border-radius: 20px;
width: 70%;
height: 400px;
margin: 50px auto;
}
</style>
<div></div>
--solutions--
<style>
div {
border-radius: 20px;
width: 70%;
height: 400px;
margin: 50px auto;
background: linear-gradient(35deg, #CCFFFF, #FFCCCC);
}
</style>
<div></div>