diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-a-negative-margin-to-an-element.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-a-negative-margin-to-an-element.chinese.md index 9957312852..60b7f83f73 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-a-negative-margin-to-an-element.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-a-negative-margin-to-an-element.chinese.md @@ -2,23 +2,30 @@ id: bad87fee1348bd9aedf08823 title: Add a Negative Margin to an Element challengeType: 0 -videoUrl: '' -localeTitle: 向元素添加负边距 +videoUrl: 'https://scrimba.com/c/cnpyGs3' +forumTopicId: 16166 +localTitle: 给元素添加负外边距 --- ## Description -
元素的margin控制元素border与周围元素之间的空间量。如果将元素的margin设置为负值,则元素将变大。
+
+元素的margin(外边距)控制元素边框与其他周围元素之间的距离大小。 +如果你设置元素margin为负值,元素会变得更大。 +
## Instructions -
尝试将margin设置为负值,如红色框的值。将蓝色框的margin更改为-15px ,因此它会填充其周围黄色框的整个水平宽度。
+
+尝试设置蓝色盒子的margin为负值,跟红色盒子一样大小。 +蓝色盒子的margin设置为-15px,它会填满与黄色盒子之间的距离。 +
## Tests
```yml tests: - - text: 你的blue-box类应该给出-15pxmargin元素。 - testString: 'assert($(".blue-box").css("margin-top") === "-15px", "Your blue-box class should give elements -15px of margin.");' + - text: '你的blue-box class的margin应该设置为-15px。' + testString: assert($(".blue-box").css("margin-top") === "-15px", '你的blue-box class的margin应该设置为-15px。'); ``` @@ -47,7 +54,7 @@ tests: background-color: yellow; padding: 10px; } - + .red-box { background-color: crimson; color: #fff; @@ -67,7 +74,6 @@ tests:
padding
padding
- ``` @@ -79,7 +85,9 @@ tests: ## Solution
-```js +```html // solution required ``` +
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-borders-around-your-elements.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-borders-around-your-elements.chinese.md index 667e0b6600..812b4c794b 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-borders-around-your-elements.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-borders-around-your-elements.chinese.md @@ -2,31 +2,50 @@ id: bad87fee1348bd9bedf08813 title: Add Borders Around Your Elements challengeType: 0 -videoUrl: '' -localeTitle: 添加元素周围的边框 +videoUrl: 'https://scrimba.com/c/c2MvnHZ' +forumTopicId: 16630 +localTitle: 在元素周围添加边框 --- ## Description -
CSS边框具有stylecolorwidth等属性。例如,如果我们想要在HTML元素周围创建一个红色的5像素边框,我们可以使用此类:
<风格>
.thin-red-border {
边框颜色:红色;
border-width:5px;
边框式:坚固;
}
</样式>
+
+CSS 边框具有stylecolorwidth属性。 +假如,我们想要创建一个 5px 的红色实线边框包围一个 HTML 元素,我们可以这样做: + +```html + +``` + +
## Instructions -
创建一个名为thick-green-border 。这个类应该在HTML元素周围添加一个10px的实心绿色边框。将课程应用于您的猫照片。请记住,您可以使用其class属性将多个类应用于元素,方法是使用空格分隔每个类名。例如: <img class="class1 class2">
+
+创建一个thick-green-border CSS class,该 class 应在 HTML 元素周围添加一个 10px 的绿色实线边框,将它应用在你的猫咪照片上。 +记得,在一个元素上可以同时应用多个class,通过使用空格来分隔。例子如下: +<img class="class1 class2"> +
## Tests
```yml tests: - - text: 您的img元素应该具有smaller-image类。 - testString: 'assert($("img").hasClass("smaller-image"), "Your img element should have the class smaller-image.");' - - text: 你的img元素应该有类thick-green-border 。 - testString: 'assert($("img").hasClass("thick-green-border"), "Your img element should have the class thick-green-border.");' - - text: 为图像提供10px的边框宽度。 - testString: 'assert($("img").hasClass("thick-green-border") && parseInt($("img").css("border-top-width"), 10) >= 8 && parseInt($("img").css("border-top-width"), 10) <= 12, "Give your image a border width of 10px.");' - - text: 为您的图像提供solid的边框样式。 - testString: 'assert($("img").css("border-right-style") === "solid", "Give your image a border style of solid.");' - - text: img元素周围的边框应为绿色。 - testString: 'assert($("img").css("border-left-color") === "rgb(0, 128, 0)", "The border around your img element should be green.");' + - text: '你的img元素应该含有smaller-image class。' + testString: assert($("img").hasClass("smaller-image"), '你的img元素应该含有smaller-image class。'); + - text: '同时,你的img元素应该含有thick-green-border class。' + testString: assert($("img").hasClass("thick-green-border"), '同时,你的img元素应该含有thick-green-border class。'); + - text: '设置你的图片边框为10px。' + testString: assert($("img").hasClass("thick-green-border") && parseInt($("img").css("border-top-width"), 10) >= 8 && parseInt($("img").css("border-top-width"), 10) <= 12, '设置你的图片边框为10px。'); + - text: '设置你的图片边框为solid实线。' + testString: assert($("img").css("border-right-style") === "solid", '设置你的图片边框为solid实线。'); + - text: 'img元素的边框颜色应该为绿色。' + testString: assert($("img").css("border-left-color") === "rgb(0, 128, 0)", 'img元素的边框颜色应该为绿色。'); ``` @@ -60,48 +79,46 @@ tests:

CatPhotoApp

-

Click here to view more cat photos.

- - A cute orange cat lying on its back. - +

点击查看更多猫图.

+ + 一只仰卧着的萌猫 +
-

Things cats love:

+

猫咪最喜欢的三件东西:

    -
  • cat nip
  • -
  • laser pointers
  • -
  • lasagna
  • +
  • 猫薄荷
  • +
  • 激光笔
  • +
  • 千层饼
-

Top 3 things cats hate:

+

猫咪最讨厌的三件东西:

    -
  1. flea treatment
  2. -
  3. thunder
  4. -
  5. other cats
  6. +
  7. 跳蚤
  8. +
  9. 打雷
  10. +
  11. 同类
- +
- -
- - -
- - + +
+ + +
+ +
- ``` - -
## Solution
-```js +```html // solution required ```
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-different-margins-to-each-side-of-an-element.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-different-margins-to-each-side-of-an-element.chinese.md index bd542d3725..68b542ff65 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-different-margins-to-each-side-of-an-element.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-different-margins-to-each-side-of-an-element.chinese.md @@ -2,29 +2,35 @@ id: bad87fee1248bd9aedf08824 title: Add Different Margins to Each Side of an Element challengeType: 0 -videoUrl: '' -localeTitle: 在元素的每一侧添加不同的边距 +videoUrl: 'https://scrimba.com/c/cg4RWh4' +forumTopicId: 16633 +localTitle: 给元素的每一侧添加不同的外边距 --- ## Description -
有时您会想要自定义元素,使其每边都有不同的margin 。 CSS允许您控制的margin与元素的所有四个单项两侧margin-topmargin-rightmargin-bottom ,和margin-left属性。
+
+有时候,你会想给一个元素每个方向的margin都设置成一个特定的值。 +CSS 允许你使用margin-topmargin-rightmargin-bottommargin-left属性来设置四个不同方向的margin值。 +
## Instructions -
蓝色框的顶部和左侧margin40px ,底部和右侧仅为20px
+
+蓝色盒子的顶部和左侧的margin值设置为40px,底部和右侧设置为20px。 +
## Tests
```yml tests: - - text: 你的blue-box类应该给元素顶部40pxmargin 。 - testString: 'assert($(".blue-box").css("margin-top") === "40px", "Your blue-box class should give the top of elements 40px of margin.");' - - text: 您的blue-box类应该赋予元素20px margin的权利。 - testString: 'assert($(".blue-box").css("margin-right") === "20px", "Your blue-box class should give the right of elements 20px of margin.");' - - text: 你的blue-box类应该给元素的底部提供20pxmargin 。 - testString: 'assert($(".blue-box").css("margin-bottom") === "20px", "Your blue-box class should give the bottom of elements 20px of margin.");' - - text: 你的blue-box类应该给元素左边40pxmargin 。 - testString: 'assert($(".blue-box").css("margin-left") === "40px", "Your blue-box class should give the left of elements 40px of margin.");' + - text: '你的blue-box class 的右侧margin(上外边距)值应为40px。' + testString: assert($(".blue-box").css("margin-top") === "40px", '你的blue-box class 的顶部margin(上外边距)值应为40px。'); + - text: '你的blue-box class 的右侧margin(右外边距)值应为20px。' + testString: assert($(".blue-box").css("margin-right") === "20px", '你的blue-box class 的右侧margin(右外边距)值应为20px。'); + - text: '你的blue-box class 的底部margin(下外边距)值应为20px。' + testString: assert($(".blue-box").css("margin-bottom") === "20px", '你的blue-box class 的底部margin(下外边距)值应为20px。'); + - text: '你的blue-box class 的左侧margin(左外边距)值应为40px。' + testString: assert($(".blue-box").css("margin-left") === "40px", '你的blue-box class 的左侧margin(左外边距)值应为40px。'); ``` @@ -53,7 +59,7 @@ tests: background-color: yellow; padding: 10px; } - + .red-box { background-color: crimson; color: #fff; @@ -74,7 +80,6 @@ tests:
padding
padding
- ``` @@ -89,4 +94,6 @@ tests: ```js // solution required ``` +
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-different-padding-to-each-side-of-an-element.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-different-padding-to-each-side-of-an-element.chinese.md index 56ec3fe333..395f2943e0 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-different-padding-to-each-side-of-an-element.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-different-padding-to-each-side-of-an-element.chinese.md @@ -2,29 +2,35 @@ id: bad87fee1348bd9aedf08824 title: Add Different Padding to Each Side of an Element challengeType: 0 -videoUrl: '' -localeTitle: 在元素的每一侧添加不同的填充 +videoUrl: 'https://scrimba.com/c/cB7mwUw' +forumTopicId: 16634 +localTitle: 给元素的每一侧添加不同的内边距 --- ## Description -
有时您会想要自定义一个元素,使其每边都有不同数量的padding 。 CSS允许您控制的padding与元素的所有四个单项两侧padding-toppadding-rightpadding-bottom ,并padding-left属性。
+
+有时候,你会想给一个元素每个方向的padding都设置成一个特定的值 +CSS 允许你使用padding-toppadding-rightpadding-bottompadding-left属性来设置四个不同方向的padding值。 +
## Instructions -
在蓝色框的顶部和左侧给出40pxpadding ,但在其底部和右侧只有20px
+
+蓝色盒子的顶部和左侧的padding值设置为40px,底部和右侧设置为20px。 +
## Tests
```yml tests: - - text: 你的blue-box类应该给出40px padding元素的顶部。 - testString: 'assert($(".blue-box").css("padding-top") === "40px", "Your blue-box class should give the top of the elements 40px of padding.");' - - text: 你的blue-box类应该给出20px padding元素的权利。 - testString: 'assert($(".blue-box").css("padding-right") === "20px", "Your blue-box class should give the right of the elements 20px of padding.");' - - text: 你的blue-box类应该给出20px padding元素的底部。 - testString: 'assert($(".blue-box").css("padding-bottom") === "20px", "Your blue-box class should give the bottom of the elements 20px of padding.");' - - text: 你的blue-box类应该给元素左边padding 40px 。 - testString: 'assert($(".blue-box").css("padding-left") === "40px", "Your blue-box class should give the left of the elements 40px of padding.");' + - text: '你的blue-box class 的顶部padding(上内边距)值应为40px。' + testString: assert($(".blue-box").css("padding-top") === "40px", '你的blue-box class 的顶部padding(上内边距)值应为40px。'); + - text: '你的blue-box class 的右侧padding(右内边距)值应为20px。' + testString: assert($(".blue-box").css("padding-right") === "20px", '你的blue-box class 的右侧padding(右内边距)值应为20px。'); + - text: '你的blue-box class 的底部padding(下内边距)值应为20px。' + testString: assert($(".blue-box").css("padding-bottom") === "20px", '你的blue-box class 的底部padding(下内边距)值应为20px。'); + - text: '你的blue-box class 的左侧padding(左内边距)值应为40px。' + testString: assert($(".blue-box").css("padding-left") === "40px", '你的blue-box class 的左侧padding(左内边距)值应为40px。'); ``` @@ -53,7 +59,7 @@ tests: background-color: yellow; padding: 10px; } - + .red-box { background-color: crimson; color: #fff; @@ -74,7 +80,6 @@ tests:
padding
padding
- ``` @@ -86,7 +91,8 @@ tests: ## Solution
-```js +```html // solution required ```
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-rounded-corners-with-border-radius.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-rounded-corners-with-border-radius.chinese.md index fef6f9e6db..7b9da2ac04 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-rounded-corners-with-border-radius.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-rounded-corners-with-border-radius.chinese.md @@ -2,25 +2,31 @@ id: bad87fee1348bd9aedf08814 title: Add Rounded Corners with border-radius challengeType: 0 -videoUrl: '' -localeTitle: 添加带有border-radius的圆角 +videoUrl: 'https://scrimba.com/c/cbZm2hg' +forumTopicId: 16649 +localTitle: 用 border-radius 添加圆角边框 --- ## Description -
你的猫照片目前有尖角。我们可以使用名为border-radius的CSS属性来舍入这些角。
+
+你的猫咪图片边角很尖锐,我们可以使用border-radius属性来让它变得圆润。 +
## Instructions -
您可以使用像素指定border-radius 。给你的猫照片border-radius 10px 。注意:此挑战允许多种可能的解决方案。例如,您可以将border-radius添加到.thick-green-border类或.smaller-image类。
+
+border-radius可以用px像素单位来赋值。给你的猫咪图片设置 10px 的border-radius。 +注意:这个挑战有多个解决方法。例如,添加border-radius属性到.thick-green-borderclass 或.smaller-imageclass 里都是可行的。 +
## Tests
```yml tests: - - text: 您的图片元素应该具有“thick-green-border”类。 - testString: 'assert($("img").hasClass("thick-green-border"), "Your image element should have the class "thick-green-border".");' - - text: 您的图像的边框半径应为10px - testString: 'assert(parseInt($("img").css("border-top-left-radius")) > 8, "Your image should have a border radius of 10px");' + - text: '你的图片元素应具有 "thick-green-border" class 属性。' + testString: assert($("img").hasClass("thick-green-border"), '你的图片元素应具有 "thick-green-border" class 属性。'); + - text: '你的图片应含有10px的边框圆角。' + testString: assert(parseInt($("img").css("border-top-left-radius")) > 8, '你的图片应含有10px的边框圆角。'); ``` @@ -60,36 +66,35 @@ tests:

CatPhotoApp

-

Click here to view more cat photos.

- - A cute orange cat lying on its back. - +

点击查看更多猫图.

+ + 一只仰卧着的萌猫 +
-

Things cats love:

+

猫咪最喜欢的三件东西:

    -
  • cat nip
  • -
  • laser pointers
  • -
  • lasagna
  • +
  • 猫薄荷
  • +
  • 激光笔
  • +
  • 千层饼
-

Top 3 things cats hate:

+

猫咪最讨厌的三件东西:

    -
  1. flea treatment
  2. -
  3. thunder
  4. -
  5. other cats
  6. +
  7. 跳蚤
  8. +
  9. 打雷
  10. +
  11. 同类
- +
- -
- - -
- - + +
+ + +
+ +
- ``` @@ -101,7 +106,8 @@ tests: ## Solution
-```js +```html // solution required ```
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/adjust-the-margin-of-an-element.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/adjust-the-margin-of-an-element.chinese.md index ad3683ef96..3f2b557235 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/adjust-the-margin-of-an-element.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/adjust-the-margin-of-an-element.chinese.md @@ -2,23 +2,30 @@ id: bad87fee1348bd9aedf08822 title: Adjust the Margin of an Element challengeType: 0 -videoUrl: '' -localeTitle: 调整元素的边距 +videoUrl: 'https://scrimba.com/c/cVJarHW' +forumTopicId: 16654 +localTitle: 调整元素的外边距 --- ## Description -
元素的margin控制元素border与周围元素之间的空间量。在这里,我们可以看到蓝色框和红色框嵌套在黄色框中。请注意,红色框的margin大于蓝色框,使其看起来更小。当您增加蓝框的margin ,它将增加其边框与周围元素之间的距离。
+
+margin(外边距)控制元素的边框与其他元素之间的距离。 +在这里,我们可以看到蓝色盒子和红色盒子都在黄色盒子里。请注意,红色盒子的margin值要比蓝色盒子的大,让它看起来比蓝色盒子要小。 +当你增加蓝色的margin值,它会增加元素边框到其他周围元素的距离。 +
## Instructions -
更改蓝色框的margin以匹配红色框的margin
+
+蓝色的盒子margin的值要跟红色盒子的一样大小。 +
## Tests
```yml tests: - - text: 你的blue-box类应该给出20pxmargin元素。 - testString: 'assert($(".blue-box").css("margin-top") === "20px", "Your blue-box class should give elements 20px of margin.");' + - text: '你的blue-box class 的margin值应为20px。' + testString: assert($(".blue-box").css("margin-top") === "20px", '你的blue-box class 的margin值应为20px。'); ``` @@ -47,7 +54,7 @@ tests: background-color: yellow; padding: 10px; } - + .red-box { background-color: crimson; color: #fff; @@ -68,7 +75,6 @@ tests:
padding
padding
- ``` @@ -84,3 +90,4 @@ tests: // solution required ```
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/adjust-the-padding-of-an-element.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/adjust-the-padding-of-an-element.chinese.md index 8c82b32779..daf038015a 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/adjust-the-padding-of-an-element.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/adjust-the-padding-of-an-element.chinese.md @@ -2,23 +2,33 @@ id: bad88fee1348bd9aedf08825 title: Adjust the Padding of an Element challengeType: 0 -videoUrl: '' -localeTitle: 调整元素的填充 +videoUrl: 'https://scrimba.com/c/cED8ZC2' +forumTopicId: 301083 +localTitle: 调整元素的内边距 --- ## Description -
现在让我们将我们的Cat Photo App放一段时间,了解更多关于样式HTML的信息。您可能已经注意到了这一点,但所有HTML元素基本上都是小矩形。三个重要属性控制每个HTML元素周围的空间: paddingmarginborder 。元素的padding控制元素内容与其border之间的空间量。在这里,我们可以看到蓝色框和红色框嵌套在黄色框中。请注意,红色框具有比蓝色框更多的padding 。当您增加蓝框的padding ,它将增加文本与其周围边框之间的距离( padding )。
+
+我们先暂时把猫咪图片放在一边,让我们去学习更多 HTML 相关样式。 +你可能已经注意到了,所有的 HTML 元素基本都是以矩形为基础。 +每个 HTML 元素周围的矩形空间由三个重要的属性来控制:padding(内边距)margin(外边距)border(边框)。 +padding控制着元素内容与border之间的空隙大小。 +在这里,我们可以看到蓝色盒子和红色盒子都在黄色盒子里面。可以发现,红色盒子比蓝色盒子有着更多的padding填充空间。 +当你增加蓝色盒子的padding值,文本内容与边框的距离会逐渐拉大。 +
## Instructions -
更改蓝色框的padding以匹配红色框的padding
+
+蓝色的盒子padding的值要跟红色盒子的一样大小。 +
## Tests
```yml tests: - - text: 你的blue-box类应该给出20pxpadding元素。 - testString: 'assert($(".blue-box").css("padding-top") === "20px", "Your blue-box class should give elements 20px of padding.");' + - text: '你的blue-box class 的padding值应为20px。' + testString: assert($(".blue-box").css("padding-top") === "20px", '你的blue-box class 的padding值应为20px。'); ``` @@ -47,7 +57,7 @@ tests: background-color: yellow; padding: 10px; } - + .red-box { background-color: crimson; color: #fff; @@ -66,7 +76,6 @@ tests:
padding
padding
- ``` @@ -78,7 +87,9 @@ tests: ## Solution
-```js +```html // solution required ``` +
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/attach-a-fallback-value-to-a-css-variable.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/attach-a-fallback-value-to-a-css-variable.chinese.md index 1587a6c829..26b0e4fb61 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/attach-a-fallback-value-to-a-css-variable.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/attach-a-fallback-value-to-a-css-variable.chinese.md @@ -2,25 +2,39 @@ id: 5a9d7286424fe3d0e10cad13 title: Attach a Fallback value to a CSS Variable challengeType: 0 -videoUrl: '' -localeTitle: 将Fallback值附加到CSS变量 +videoUrl: 'https://scrimba.com/c/c6bDNfp' +forumTopicId: 301084 +localTitle: 给 CSS 变量附加回退值 --- ## Description -
将变量用作CSS属性值时,如果给定变量无效,则可以附加浏览器将恢复的回退值。 注意:此回退不用于增加浏览器兼容性,并且它不适用于IE浏览器。而是使用它,以便浏览器在无法找到变量时显示颜色。这是你如何做到的:
背景:var( - 企鹅皮,黑色);
如果未设置变量,则会将背景设置为黑色。请注意,这对于调试很有用。
+
+使用变量来作为 CSS 属性值的时候,可以设置一个备用值来防止由于某些原因导致变量不生效的情况。 +或许有些人正在使用着不支持 CSS 变量的旧浏览器,又或者,设备不支持你设置的变量值。为了防止这种情况出现,那么你可以这样写: + +```css +background: var(--penguin-skin, black); +``` + +这样,当你的变量有问题的时候,它会设置你的背景颜色为黑色。 +提示:这对调试会很有帮助。 +
## Instructions -
它看起来提供给.penguin-top.penguin-bottom类的变量存在问题。而不是修复拼写错误,将.penguin-top值的black添加到.penguin-top.penguin-bottom类的background属性中。
+
+在penguin-toppenguin-bottomclass 里面,background属性设置一个black的备用色。 +注意:因为 CSS 变量名拼写错了,所以备用值会被使用。 +
## Tests
```yml tests: - - text: 的后退值应用于blackbackground的财产penguin-top班。 - testString: 'assert(code.match(/.penguin-top\s*?{[\s\S]*background\s*?:\s*?var\(\s*?--pengiun-skin\s*?,\s*?black\s*?\)\s*?;[\s\S]*}[\s\S]*.penguin-bottom\s{/gi), "Apply the fallback value of black to the background property of the penguin-top class.");' - - text: 将black的后备值应用于penguin-bottom类的background属性。 - testString: 'assert(code.match(/.penguin-bottom\s*?{[\s\S]*background\s*?:\s*?var\(\s*?--pengiun-skin\s*?,\s*?black\s*?\)\s*?;[\s\S]*}/gi), "Apply the fallback value of black to the background property of the penguin-bottom class.");' + - text: 'penguin-top class 的background属性应设置一个black备用颜色。' + testString: 'assert(code.match(/.penguin-top\s*?{[\s\S]*background\s*?:\s*?var\(\s*?--pengiun-skin\s*?,\s*?black\s*?\)\s*?;[\s\S]*}[\s\S]*.penguin-bottom\s{/gi), ''penguin-top class 的background属性应设置一个black备用颜色。'');' + - text: 'penguin-bottom class 的background属性应设置一个black备用颜色。' + testString: 'assert(code.match(/.penguin-bottom\s*?{[\s\S]*background\s*?:\s*?var\(\s*?--pengiun-skin\s*?,\s*?black\s*?\)\s*?;[\s\S]*}/gi), ''penguin-bottom class 的background属性应设置一个black备用颜色。'');' ``` @@ -44,33 +58,33 @@ tests: width: 300px; height: 300px; } - + .penguin-top { top: 10%; left: 25%; - + /* change code below */ background: var(--pengiun-skin); /* change code above */ - + width: 50%; height: 45%; border-radius: 70% 70% 60% 60%; } - + .penguin-bottom { top: 40%; left: 23.5%; - + /* change code below */ background: var(--pengiun-skin); /* change code above */ - + width: 53%; height: 45%; border-radius: 70% 70% 100% 100%; } - + .right-hand { top: 0%; left: -5%; @@ -81,7 +95,7 @@ tests: transform: rotate(45deg); z-index: -1; } - + .left-hand { top: 0%; left: 75%; @@ -92,7 +106,7 @@ tests: transform: rotate(-45deg); z-index: -1; } - + .right-cheek { top: 15%; left: 35%; @@ -101,7 +115,7 @@ tests: height: 70%; border-radius: 70% 70% 60% 60%; } - + .left-cheek { top: 15%; left: 5%; @@ -110,7 +124,7 @@ tests: height: 70%; border-radius: 70% 70% 60% 60%; } - + .belly { top: 60%; left: 2.5%; @@ -119,7 +133,7 @@ tests: height: 100%; border-radius: 120% 120% 100% 100%; } - + .right-feet { top: 85%; left: 60%; @@ -130,7 +144,7 @@ tests: transform: rotate(-80deg); z-index: -2222; } - + .left-feet { top: 85%; left: 25%; @@ -141,7 +155,7 @@ tests: transform: rotate(80deg); z-index: -2222; } - + .right-eye { top: 45%; left: 60%; @@ -150,7 +164,7 @@ tests: height: 17%; border-radius: 50%; } - + .left-eye { top: 45%; left: 25%; @@ -159,7 +173,7 @@ tests: height: 17%; border-radius: 50%; } - + .sparkle { top: 25%; left: 15%; @@ -168,7 +182,7 @@ tests: height: 35%; border-radius: 50%; } - + .blush-right { top: 65%; left: 15%; @@ -177,7 +191,7 @@ tests: height: 10%; border-radius: 50%; } - + .blush-left { top: 65%; left: 70%; @@ -186,7 +200,7 @@ tests: height: 10%; border-radius: 50%; } - + .beak-top { top: 60%; left: 40%; @@ -195,7 +209,7 @@ tests: height: 10%; border-radius: 50%; } - + .beak-bottom { top: 65%; left: 42%; @@ -204,11 +218,11 @@ tests: height: 10%; border-radius: 50%; } - + body { background:#c6faf1; } - + .penguin * { position: absolute; } @@ -236,7 +250,6 @@ tests:
- ``` @@ -248,7 +261,10 @@ tests: ## Solution
+ ```js // solution required ``` +
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/change-a-variable-for-a-specific-area.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/change-a-variable-for-a-specific-area.chinese.md index b38e533195..ed6e9422c7 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/change-a-variable-for-a-specific-area.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/change-a-variable-for-a-specific-area.chinese.md @@ -2,23 +2,30 @@ id: 5a9d72a1424fe3d0e10cad15 title: Change a variable for a specific area challengeType: 0 -videoUrl: '' -localeTitle: 更改特定区域的变量 +videoUrl: 'https://scrimba.com/c/cdRwbuW' +forumTopicId: 301085 +localTitle: 更改特定区域的变量 --- ## Description -
当您在创建变量:root ,他们将设置可变整个页面的价值。然后,您可以通过在特定元素中再次设置它们来覆盖这些变量。
+
+当你在:root里创建变量时,这些变量的作用域是整个页面。 +如果在元素里创建相同的变量,会重写:root变量设置的值。 + +
## Instructions -
penguin--penguin-belly的值更改为white
+
+在penguinclass 里,设置--penguin-belly的值为white。 +
## Tests
```yml tests: - - text: penguin类应该将--penguin-belly变量重新分配为white 。 - testString: 'assert(code.match(/.penguin\s*?{[\s\S]*--penguin-belly\s*?:\s*?white\s*?;[\s\S]*}/gi), "The penguin class should reassign the --penguin-belly variable to white.");' + - text: '应该在penguinclas 里重定义--penguin-belly的变量值,且它的值为white。' + testString: 'assert(code.match(/.penguin\s*?{[\s\S]*--penguin-belly\s*?:\s*?white\s*?;[\s\S]*}/gi), ''应该在penguinclas 里重定义--penguin-belly的变量值,且它的值为white。'');' ``` @@ -36,17 +43,17 @@ tests: --penguin-belly: pink; --penguin-beak: orange; } - + body { background: var(--penguin-belly, #c6faf1); } - + .penguin { - + /* add code below */ - + /* add code above */ - + position: relative; margin: auto; display: block; @@ -54,7 +61,7 @@ tests: width: 300px; height: 300px; } - + .right-cheek { top: 15%; left: 35%; @@ -63,7 +70,7 @@ tests: height: 70%; border-radius: 70% 70% 60% 60%; } - + .left-cheek { top: 15%; left: 5%; @@ -72,7 +79,7 @@ tests: height: 70%; border-radius: 70% 70% 60% 60%; } - + .belly { top: 60%; left: 2.5%; @@ -81,7 +88,7 @@ tests: height: 100%; border-radius: 120% 120% 100% 100%; } - + .penguin-top { top: 10%; left: 25%; @@ -90,7 +97,7 @@ tests: height: 45%; border-radius: 70% 70% 60% 60%; } - + .penguin-bottom { top: 40%; left: 23.5%; @@ -99,7 +106,7 @@ tests: height: 45%; border-radius: 70% 70% 100% 100%; } - + .right-hand { top: 0%; left: -5%; @@ -110,7 +117,7 @@ tests: transform: rotate(45deg); z-index: -1; } - + .left-hand { top: 0%; left: 75%; @@ -121,7 +128,7 @@ tests: transform: rotate(-45deg); z-index: -1; } - + .right-feet { top: 85%; left: 60%; @@ -132,7 +139,7 @@ tests: transform: rotate(-80deg); z-index: -2222; } - + .left-feet { top: 85%; left: 25%; @@ -143,7 +150,7 @@ tests: transform: rotate(80deg); z-index: -2222; } - + .right-eye { top: 45%; left: 60%; @@ -152,7 +159,7 @@ tests: height: 17%; border-radius: 50%; } - + .left-eye { top: 45%; left: 25%; @@ -161,7 +168,7 @@ tests: height: 17%; border-radius: 50%; } - + .sparkle { top: 25%; left: 15%; @@ -170,7 +177,7 @@ tests: height: 35%; border-radius: 50%; } - + .blush-right { top: 65%; left: 15%; @@ -179,7 +186,7 @@ tests: height: 10%; border-radius: 50%; } - + .blush-left { top: 65%; left: 70%; @@ -188,7 +195,7 @@ tests: height: 10%; border-radius: 50%; } - + .beak-top { top: 60%; left: 40%; @@ -197,7 +204,7 @@ tests: height: 10%; border-radius: 50%; } - + .beak-bottom { top: 65%; left: 42%; @@ -206,7 +213,7 @@ tests: height: 10%; border-radius: 50%; } - + .penguin * { position: absolute; } @@ -234,7 +241,6 @@ tests:
- ``` @@ -246,7 +252,10 @@ tests: ## Solution
+ ```js // solution required ``` +
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/change-the-color-of-text.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/change-the-color-of-text.chinese.md index 3b52a95dde..784c87222a 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/change-the-color-of-text.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/change-the-color-of-text.chinese.md @@ -2,25 +2,36 @@ id: bad87fee1348bd9aedf08803 title: Change the Color of Text challengeType: 0 -videoUrl: '' -localeTitle: 更改文本的颜色 +videoUrl: 'https://scrimba.com/c/cPp7VfD' +forumTopicId: 1 +localTitle: 更改文本的颜色 --- ## Description -
现在让我们改变一些文字的颜色。我们可以通过改变你的h2元素的style来做到这一点。负责元素文本color属性是color样式属性。以下是将h2元素的文本颜色设置为蓝色的方法: <h2 style="color: blue;">CatPhotoApp</h2>请注意,最好使用;结束内联style声明;
+
+现在让我们来修改一下文本的颜色。 +我们通过修改h2元素的style属性的color值来改变文本颜色。 +以下是改变h2元素为蓝色的方法: +<h2 style="color: blue;">CatPhotoApp</h2> +请注意行内style最好以;来结束。 +
## Instructions -
更改h2元素的样式,使其文本颜色为红色。
+
+请把h2元素的文本颜色设置为红色。 +
## Tests
```yml tests: - - text: 你的h2元素应该是红色的。 - testString: 'assert($("h2").css("color") === "rgb(255, 0, 0)", "Your h2 element should be red.");' - - text: 你的style声明应以a结尾; 。 - testString: 'assert(code.match(/\s*CatPhotoApp\s*<\/h2>/)," Your style declaration should end with a ; .");' + - text: 'h2元素应该为红色。' + testString: assert($("h2").css("color") === "rgb(255, 0, 0)", 'h2元素应该为红色。'); + - text: 'h2元素的style属性值应该以;结束。' + testString: 'assert(code.match(/\s*CatPhotoApp\s*<\/h2>/),''h2元素的style属性值应该以;结束。'');' + - text: 'style 声明应该以 ; 结尾' + testString: assert($("h2").attr('style') && $("h2").attr('style').endsWith(';')); ``` @@ -34,36 +45,35 @@ tests: ```html

CatPhotoApp

-

Click here to view more cat photos.

+

点击查看更多猫图.

- A cute orange cat lying on its back. + 一只仰卧着的萌猫
-

Things cats love:

+

猫咪最喜欢的三件东西:

    -
  • cat nip
  • -
  • laser pointers
  • -
  • lasagna
  • +
  • 猫薄荷
  • +
  • 激光笔
  • +
  • 千层饼
-

Top 3 things cats hate:

+

猫咪最讨厌的三件东西:

    -
  1. flea treatment
  2. -
  3. thunder
  4. -
  5. other cats
  6. +
  7. 跳蚤
  8. +
  9. 打雷
  10. +
  11. 同类
- +
- -
- - -
- - + +
+ + +
+ +
- ``` @@ -75,7 +85,8 @@ tests: ## Solution
-```js +```html // solution required ```
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/change-the-font-size-of-an-element.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/change-the-font-size-of-an-element.chinese.md index b7d2d2ec6d..e1e9df0382 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/change-the-font-size-of-an-element.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/change-the-font-size-of-an-element.chinese.md @@ -2,23 +2,35 @@ id: bad87fee1348bd9aedf08806 title: Change the Font Size of an Element challengeType: 0 -videoUrl: '' -localeTitle: 更改元素的字体大小 +videoUrl: 'https://scrimba.com/c/cPp7VfD' +forumTopicId: 1 +localTitle: 更改元素的字体大小 --- ## Description -
字体大小由font-size CSS属性控制,如下所示:
h1 {
font-size:30px;
}
+
+字体大小由font-size属性控制,如下所示: + +```css +h1 { + font-size: 30px; +} +``` + +
## Instructions -
里面的相同<style>包含您的标记red-text类,创建一个条目p元素和设置font-size为16个像素( 16px )。
+
+在包含red-textclass 选择器的<style>声明区域的里,创建一个p元素样式规则,并设置font-size16px。 +
## Tests
```yml tests: - - text: 在style标记之间,给出p元素font-size16px 。浏览器和文本缩放应为100%。 - testString: 'assert(code.match(/p\s*{\s*font-size\s*:\s*16\s*px\s*;\s*}/i), "Between the style tags, give the p elements font-size of 16px. Browser and Text zoom should be at 100%.");' + - text: '在style样式声明区域里,p元素的font-size的值应为16px,浏览器和文本缩放应设置为 100%。' + testString: 'assert(code.match(/p\s*{\s*font-size\s*:\s*16\s*px\s*;\s*}/i), ''在style样式声明区域里,p元素的font-size的值应为16px,浏览器和文本缩放应设置为 100%。'');' ``` @@ -38,36 +50,35 @@ tests:

CatPhotoApp

-

Click here to view more cat photos.

+

点击查看更多猫图.

- A cute orange cat lying on its back. + 一只仰卧着的萌猫
-

Things cats love:

+

猫咪最喜欢的三件东西:

    -
  • cat nip
  • -
  • laser pointers
  • -
  • lasagna
  • +
  • 猫薄荷
  • +
  • 激光笔
  • +
  • 千层饼
-

Top 3 things cats hate:

+

猫咪最讨厌的三件东西:

    -
  1. flea treatment
  2. -
  3. thunder
  4. -
  5. other cats
  6. +
  7. 跳蚤
  8. +
  9. 打雷
  10. +
  11. 同类
- +
- -
- - -
- - + +
+ + +
+ +
- ``` @@ -79,7 +90,8 @@ tests: ## Solution
-```js +```html // solution required ```
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/create-a-custom-css-variable.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/create-a-custom-css-variable.chinese.md index 19adeacd7e..ed38b2038f 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/create-a-custom-css-variable.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/create-a-custom-css-variable.chinese.md @@ -2,23 +2,35 @@ id: 5a9d726c424fe3d0e10cad11 title: Create a custom CSS Variable challengeType: 0 -videoUrl: '' -localeTitle: 创建自定义CSS变量 +videoUrl: 'https://scrimba.com/c/cQd27Hr' +forumTopicId: 301086 +localTitle: 创建一个自定义的 CSS 变量 --- ## Description -
要创建一个CSS变量,你只需要给它一个nametwo dashes在它前面,并为其分配一个value是这样的:
- penguin-skin:灰色;
这将创建一个名为--penguin-skin的变量,并为其赋值为gray 。现在,您可以在CSS中的其他位置使用该变量将其他元素的值更改为灰色。
+
+创建一个 CSS 变量,你只需要在变量名前添加两个破折号,并为其赋值,例子如下: + +```css +--penguin-skin: gray; +``` + +这样会创建一个--penguin-skin变量并赋值为gray(灰色)。 +现在,其他元素可通过该变量来设置为gray(灰色)。 +
## Instructions -
penguin类中,创建一个变量名称--penguin-skin并赋予它一个gray
+
+在penguinclass 里面,创建一个--penguin-skin变量,且赋值为gray(灰色)。 +
## Tests
```yml tests: - - text: penguin类应声明--penguin-skin变量并将其指定为gray 。 - testString: 'assert(code.match(/.penguin\s*?{[\s\S]*--penguin-skin\s*?:\s*?gray\s*?;[\s\S]*}/gi), "penguin class should declare the --penguin-skin variable and assign it to gray.");' + - text: 'penguin class 里应声明--penguin-skin变量,且赋值为gray。' + testString: 'assert(code.match(/.penguin\s*?{[\s\S]*--penguin-skin\s*?:\s*?gray\s*?;[\s\S]*}/gi), ''penguin class 里应声明--penguin-skin变量,且赋值为gray。'');' ``` @@ -32,9 +44,9 @@ tests: ```html
- ``` @@ -54,7 +60,20 @@ tests: ## Solution
-```js -// solution required + +```html + +
``` +
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/cascading-css-variables.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/inherit-css-variables.chinese.md similarity index 76% rename from curriculum/challenges/chinese/01-responsive-web-design/basic-css/cascading-css-variables.chinese.md rename to curriculum/challenges/chinese/01-responsive-web-design/basic-css/inherit-css-variables.chinese.md index 84b99155ce..12b20f0362 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/cascading-css-variables.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/inherit-css-variables.chinese.md @@ -1,24 +1,30 @@ --- id: 5a9d7295424fe3d0e10cad14 -title: Cascading CSS variables +title: Inherit CSS Variables challengeType: 0 -videoUrl: '' -localeTitle: 级联CSS变量 +videoUrl: 'https://scrimba.com/c/cyLZZhZ' +forumTopicId: 301088 +localTitle: 继承 CSS 变量 --- ## Description -
创建变量时,您可以在创建变量的元素内使用它。它也可以在嵌套在其中的任何元素中使用。这种效应称为级联 。由于级联,CSS变量通常在:root元素中定义。 :root是一个伪类选择器,它匹配文档的根元素,通常是元件。通过在:root创建变量,它们将在全局可用,并且可以在样式表中的任何其他选择器中访问。
+
+当创建一个变量时,变量会在创建的选择器里可用。同时,在这个选择器的后代里面也是可用的。这是因为 CSS 变量是可继承的,和普通的属性一样。 +CSS 变量经常会定义在 :root 元素内,这样就可被所有选择器继承。:root 是一个 pseudo-class 选择器匹配文档的根选择器,通常指 html 元素。通过在 :root 里创建变量,变量在全局可用,以及在 style 样式的选择器里也生效。 +
## Instructions -
:root选择器中定义一个名为--penguin-belly的变量,并为其赋值pink 。然后,您可以在任何使用该变量的位置查看该值将如何级联以将值更改为粉红色。
+
+在 :root 选择器里定义变量 --penguin-belly 并赋值 pink。会发现变量被继承,所有使用该变量的子元素都会有 pink 背景。 +
## Tests
```yml tests: - - text: '在:root声明--penguin-belly变量并将其指定为pink 。' - testString: 'assert(code.match(/:root\s*?{[\s\S]*--penguin-belly\s*?:\s*?pink\s*?;[\s\S]*}/gi), "declare the --penguin-belly variable in the :root and assign it to pink.");' + - text: '应该在 :root 里声明 --penguin-belly 变量并赋值 pink。' + testString: assert(code.match(/:root\s*?{[\s\S]*--penguin-belly\s*?:\s*?pink\s*?;[\s\S]*}/gi)); ``` @@ -232,7 +238,6 @@ tests:
- ``` @@ -244,7 +249,9 @@ tests: ## Solution
+ ```js -// solution required +var code = ":root {--penguin-belly: pink;}" ``` +
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/inherit-styles-from-the-body-element.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/inherit-styles-from-the-body-element.chinese.md index 80eacf1b55..505f80fd5c 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/inherit-styles-from-the-body-element.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/inherit-styles-from-the-body-element.chinese.md @@ -2,35 +2,43 @@ id: bad87fee1348bd9aedf08746 title: Inherit Styles from the Body Element challengeType: 0 -videoUrl: '' -localeTitle: 从Body元素继承样式 +videoUrl: 'https://scrimba.com/c/c9bmdtR' +forumTopicId: 18204 +localTitle: 从 Body 元素继承样式 --- ## Description -
现在我们已经证明每个HTML页面都有一个body元素,并且它的body元素也可以用CSS设置样式。记住,你可以风格你body元素,就像任何其他HTML元素,和所有其他元素将继承你的body元素的样式。
+
+我们已经证明每一个 HTML 页面都含有body元素,body元素也可以使用 CSS 样式。 +设置body元素的样式的方式跟设置其他 HTML 元素的样式一样,并且其他元素也会继承到body设置的样式。 +
## Instructions -
首先,创建一个h1与文本元素Hello World然后,让我们给您的网页上的所有元素的颜色green中加入color: green;你的body元素的风格声明。最后,通过添加font-family: monospace; ,为你的body元素提供monospacefont-family: monospace;你的body元素的风格声明。
+
+首先,创建一个文本内容为Hello Worldh1标签元素。 +接着,在bodyCSS 规则里面添加一句color: green;,改变页面其他元素的字体颜色为green(绿色)。 +最后,同样在bodyCSS 规则里面添加font-family: monospace;,设置其他元素字体为font-family: monospace;。 +
## Tests
```yml tests: - - text: 创建一个h1元素。 - testString: 'assert(($("h1").length > 0), "Create an h1 element.");' - - text: 你的h1元素应该有文本Hello World 。 - testString: 'assert(($("h1").length > 0 && $("h1").text().match(/hello world/i)), "Your h1 element should have the text Hello World.");' - - text: 确保您的h1元素具有结束标记。 - testString: 'assert(code.match(/<\/h1>/g) && code.match(/

/g).length === code.match(/

h1 element has a closing tag.");' - - text: 为你的body元素赋予greencolor属性。 - testString: 'assert(($("body").css("color") === "rgb(0, 128, 0)"), "Give your body element the color property of green.");' - - text: 为body元素提供monospacefont-family属性。 - testString: 'assert(($("body").css("font-family").match(/monospace/i)), "Give your body element the font-family property of monospace.");' - - text: 你的h1元素应该从你的body元素继承font monospace 。 - testString: 'assert(($("h1").length > 0 && $("h1").css("font-family").match(/monospace/i)), "Your h1 element should inherit the font monospace from your body element.");' - - text: 您的h1元素应该从您的body元素继承绿色。 - testString: 'assert(($("h1").length > 0 && $("h1").css("color") === "rgb(0, 128, 0)"), "Your h1 element should inherit the color green from your body element.");' + - text: '创建一个h1元素。' + testString: assert(($("h1").length > 0), '创建一个h1元素。'); + - text: 'h1元素的文本内容应该为Hello World。' + testString: assert(($("h1").length > 0 && $("h1").text().match(/hello world/i)), 'h1元素的文本内容应该为Hello World。'); + - text: '确保你的h1元素具有结束标记。' + testString: assert(code.match(/<\/h1>/g) && code.match(/

/g).length === code.match(/

h1元素具有结束标记。'); + - text: 'body元素的color属性值应为green。' + testString: assert(($("body").css("color") === "rgb(0, 128, 0)"), 'body元素的color属性值应为green。'); + - text: 'body元素的font-family属性值应为monospace。' + testString: assert(($("body").css("font-family").match(/monospace/i)), 'body元素的font-family属性值应为monospace。'); + - text: 'h1元素应该继承bodymonospace字体属性。' + testString: assert(($("h1").length > 0 && $("h1").css("font-family").match(/monospace/i)), 'h1元素应该继承bodymonospace字体属性。'); + - text: 'h1元素的字体颜色也应该继承body元素的绿色。' + testString: assert(($("h1").length > 0 && $("h1").css("color") === "rgb(0, 128, 0)"), 'h1元素的字体颜色也应该继承body元素的绿色。'); ``` @@ -48,7 +56,6 @@ tests: } - ``` @@ -60,7 +67,8 @@ tests: ## Solution
-```js +```html // solution required ```
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/make-circular-images-with-a-border-radius.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/make-circular-images-with-a-border-radius.chinese.md index b23255c679..5fc95b712c 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/make-circular-images-with-a-border-radius.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/make-circular-images-with-a-border-radius.chinese.md @@ -2,25 +2,30 @@ id: bad87fee1348bd9aedf08815 title: Make Circular Images with a border-radius challengeType: 0 -videoUrl: '' -localeTitle: 使用border-radius制作圆形图像 +videoUrl: 'https://scrimba.com/c/c2MvrcB' +forumTopicId: 18229 +localTitle: 用 border-radius 制作圆形图片 --- ## Description -
除像素外,您还可以使用百分比指定border-radius
+
+除像素外,你也可以使用百分比来指定border-radius的值。 +
## Instructions -
给你的猫照片border-radius50%
+
+将border-radius的值设置为50%。 +
## Tests
```yml tests: - - text: 您的图像应具有50%的边框半径,使其完美呈圆形。 - testString: 'assert(parseInt($("img").css("border-top-left-radius")) > 48, "Your image should have a border radius of 50%, making it perfectly circular.");' - - text: 请务必使用50%的百分比值。 - testString: 'assert(code.match(/50%/g), "Be sure to use a percentage value of 50%.");' + - text: '你图片的边框圆角应设置为50%,让它看起来就像一个完整的圆。' + testString: assert(parseInt($("img").css("border-top-left-radius")) > 48, '你图片的边框圆角应设置为50%,让它看起来就像一个完整的圆。'); + - text: '请确保百分值为50%。' + testString: assert(code.match(/50%/g), '请确保百分值为50%。'); ``` @@ -61,36 +66,35 @@ tests:

CatPhotoApp

-

Click here to view more cat photos.

+

点击查看更多猫图.

- A cute orange cat lying on its back. + 一只仰卧着的萌猫
-

Things cats love:

+

猫咪最喜欢的三件东西:

    -
  • cat nip
  • -
  • laser pointers
  • -
  • lasagna
  • +
  • 猫薄荷
  • +
  • 激光笔
  • +
  • 千层饼
-

Top 3 things cats hate:

+

猫咪最讨厌的三件东西:

    -
  1. flea treatment
  2. -
  3. thunder
  4. -
  5. other cats
  6. +
  7. 跳蚤
  8. +
  9. 打雷
  10. +
  11. 同类
- +
- -
- - -
- - + +
+ + +
+ +
- ``` @@ -102,7 +106,9 @@ tests: ## Solution
-```js +```html // solution required ``` +
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/override-all-other-styles-by-using-important.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/override-all-other-styles-by-using-important.chinese.md index bf8a67e2be..7e9b622a74 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/override-all-other-styles-by-using-important.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/override-all-other-styles-by-using-important.chinese.md @@ -2,33 +2,44 @@ id: bad87fee1348bd9aedf07756 title: Override All Other Styles by using Important challengeType: 0 -videoUrl: '' -localeTitle: 使用重要覆盖所有其他样式 +videoUrl: 'https://scrimba.com/c/cm24rcp' +forumTopicId: 18249 +localTitle: Important 的优先级最高 --- ## Description -
好极了!我们刚刚证明了内联样式将覆盖style元素中的所有CSS声明。可是等等。有一种覆盖CSS的最后一种方法。这是所有人中最强大的方法。但在我们这样做之前,让我们谈谈为什么你想要覆盖CSS。在许多情况下,您将使用CSS库。这些可能会意外地覆盖您自己的CSS。所以当你绝对需要确定一个元素有特定的CSS时,你可以使用!important让我们一直回到我们的pink-text类声明。请记住,我们的pink-text类被后续的类声明,id声明和内联样式覆盖。
+
+耶!我们刚刚又证明了行内样式会覆盖style标签里面所有的 CSS 声明。 +不过,还有一种方式可以覆盖重新 CSS 样式。这是所有方法里面最强大的一个。在此之前,我们要考虑清楚,为什么我们需要覆盖 CSS 样式。 +在很多时候,你使用 CSS 库,有时候它们声明的样式会意外的覆盖你的 CSS 样式。当你需要保证你的 CSS 样式不受影响,你可以使用!important。 +让我们回到pink-textclass 声明之中,它已经被随其后的 class 声明,id 声明,以及行内样式所覆盖。 +
## Instructions -
让我们在粉红色文本元素的颜色声明中添加关键字!important ,以100%确定你的h1元素是粉红色的。如何执行此操作的示例是: color: red !important;
+
+ +在pink-textclass 的color声明里面使用!important关键字,去确保h1元素的字体颜色一定为粉色。 +操作的方法大概如下: +color: red !important; +
## Tests
```yml tests: - - text: 您的h1元素应该具有pink-text类。 - testString: 'assert($("h1").hasClass("pink-text"), "Your h1 element should have the class pink-text.");' - - text: 你的h1元素应该有blue-text 。 - testString: 'assert($("h1").hasClass("blue-text"), "Your h1 element should have the class blue-text.");' - - text: 您的h1元素应具有orange-text的ID。 - testString: 'assert($("h1").attr("id") === "orange-text", "Your h1 element should have the id of orange-text.");' - - text: '您的h1元素应具有内联样式的color: white 。' - testString: 'assert(code.match(/h1 element should have the inline style of color: white.");' - - text: 你的pink-text类声明应该有!important关键字来覆盖所有其他声明。 - testString: 'assert(code.match(/\.pink-text\s*?\{[\s\S]*?color:.*pink.*!important\s*;?[^\.]*\}/g), "Your pink-text class declaration should have the !important keyword to override all other declarations.");' - - text: 你的h1元素应该是粉红色的。 - testString: 'assert($("h1").css("color") === "rgb(255, 192, 203)", "Your h1 element should be pink.");' + - text: 'h1元素应该包含pink-text class。' + testString: assert($("h1").hasClass("pink-text"), 'h1元素应该包含pink-text class。'); + - text: 'h1元素应该包含blue-text class。' + testString: assert($("h1").hasClass("blue-text"), 'h1元素应该包含blue-text class。'); + - text: 'h1元素应该包含一个名为orange-text的id。' + testString: assert($("h1").attr("id") === "orange-text", 'h1元素应该包含一个名为orange-text的id。'); + - text: 'h1元素应该包含color: white的行内样式声明。' + testString: 'assert(code.match(/h1元素应该包含color: white的行内样式声明。'');' + - text: 'pink-text class 声明应该含有!important关键字。' + testString: 'assert(code.match(/\.pink-text\s*?\{[\s\S]*?color:.*pink.*!important\s*;?[^\.]*\}/g), ''pink-text class 声明应该含有!important关键字。'');' + - text: 'h1元素的字体颜色应该为粉色。' + testString: assert($("h1").css("color") === "rgb(255, 192, 203)", 'h1元素的字体颜色应该为粉色。'); ``` @@ -57,7 +68,6 @@ tests: }

Hello World!

- ``` @@ -69,7 +79,9 @@ tests: ## Solution
-```js +```html // solution required ``` +
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/override-class-declarations-by-styling-id-attributes.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/override-class-declarations-by-styling-id-attributes.chinese.md index b43b09184d..961da1658e 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/override-class-declarations-by-styling-id-attributes.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/override-class-declarations-by-styling-id-attributes.chinese.md @@ -2,35 +2,53 @@ id: bad87fee1348bd8aedf06756 title: Override Class Declarations by Styling ID Attributes challengeType: 0 -videoUrl: '' -localeTitle: 通过样式ID属性覆盖类声明 +videoUrl: 'https://scrimba.com/c/cRkpDhB' +forumTopicId: 18251 +localTitle: ID 选择器优先级高于 Class 选择器 --- ## Description -
我们刚刚证明了浏览器从上到下读取CSS。这意味着,如果发生冲突,浏览器将使用最后的CSS声明。但我们还没有完成。还有其他方法可以覆盖CSS。你还记得id属性吗?让我们覆盖你的pink-textblue-text类,并通过给h1元素一个id然后设置那个id样式,使你的h1元素变成橙色。
+
+我们刚刚证明了浏览器读取 CSS 是由上到下的。这就意味着,如果发生冲突,浏览器将会应用最后声明的样式。 +不过我们还没结束,还有其他方法来覆盖 CSS 样式。你还记得 id 属性吗? +通过给h1元素添加 id 属性,来覆盖 class 属性定义的同名样式。 +
## Instructions -
为你的h1元素提供orange-textid属性。请记住,id样式如下所示: <h1 id="orange-text">h1元素上保留blue-textpink-text类。在style元素中为您的orange-text id创建一个CSS声明。这是一个示例:
#brown-text {
颜色:棕色;
}
注意:无论您是在粉红色文本类之上还是之下声明此CSS都无关紧要,因为id属性始终优先。
+
+给h1元素添加 id 属性,属性值为orange-text。设置方式如下: +<h1 id="orange-text"> +h1元素继续保留blue-textpink-textclass。 +在style元素中创建名为orange-text的 id 选择器。例子如下: + +```css +#brown-text { + color: brown; +} +``` + +注意:无论在pink-textclass 的上面或者下面声明,id 选择器的优先级总是会高于 class 选择器。 +
## Tests
```yml tests: - - text: 您的h1元素应该具有pink-text类。 - testString: 'assert($("h1").hasClass("pink-text"), "Your h1 element should have the class pink-text.");' - - text: 你的h1元素应该有blue-text 。 - testString: 'assert($("h1").hasClass("blue-text"), "Your h1 element should have the class blue-text.");' - - text: 为你的h1元素提供orange-text的id。 - testString: 'assert($("h1").attr("id") === "orange-text", "Give your h1 element the id of orange-text.");' - - text: 应该只有一个h1元素。 - testString: 'assert(($("h1").length === 1), "There should be only one h1 element.");' - - text: 为您的orange-text ID创建一个CSS声明 - testString: 'assert(code.match(/#orange-text\s*{/gi), "Create a CSS declaration for your orange-text id");' - - text: 不要给你的h1任何style属性。 - testString: 'assert(!code.match(//gi), "Do not give your h1 any style attributes.");' - - text: 你的h1元素应该是橙色的。 - testString: 'assert($("h1").css("color") === "rgb(255, 165, 0)", "Your h1 element should be orange.");' + - text: 'h1元素应该包含pink-text class。' + testString: assert($("h1").hasClass("pink-text"), 'h1元素应该包含pink-text class。'); + - text: 'h1元素应该包含blue-text class。' + testString: assert($("h1").hasClass("blue-text"), 'h1元素应该包含blue-text class。'); + - text: 'h1的 id 属性值为orange-text。' + testString: assert($("h1").attr("id") === "orange-text", 'h1的 id 属性值为orange-text。'); + - text: '应该只有一个h1元素。' + testString: assert(($("h1").length === 1), '应该只有一个h1元素。'); + - text: '创建名为orange-text的 id 选择器。' + testString: assert(code.match(/#orange-text\s*{/gi), '创建名为orange-text的 id 选择器。'); + - text: '不要在h1元素里面使用style(行内样式)。' + testString: assert(!code.match(//gi), '不要在h1元素里面使用style(行内样式)。'); + - text: 'h1元素的字体颜色应为橘色。' + testString: assert($("h1").css("color") === "rgb(255, 165, 0)", 'h1元素的字体颜色应为橘色。'); ``` @@ -56,7 +74,6 @@ tests: }

Hello World!

- ``` @@ -68,7 +85,9 @@ tests: ## Solution
-```js +```html // solution required ``` +
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/override-class-declarations-with-inline-styles.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/override-class-declarations-with-inline-styles.chinese.md index dccf16948f..fadadab79b 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/override-class-declarations-with-inline-styles.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/override-class-declarations-with-inline-styles.chinese.md @@ -2,31 +2,39 @@ id: bad87fee1348bd9aedf06756 title: Override Class Declarations with Inline Styles challengeType: 0 -videoUrl: '' -localeTitle: 使用内联样式覆盖类声明 +videoUrl: 'https://scrimba.com/c/cGJDRha' +forumTopicId: 18252 +localTitle: 内联样式的优先级高于 ID 选择器 --- ## Description -
所以我们已经证明了id声明覆盖了类声明,无论它们在style元素CSS中的声明位置如何。还有其他方法可以覆盖CSS。你还记得内联样式吗?
+
+我们刚刚证明了,id 选择器无论在style标签哪里声明,都会覆盖 class 声明的样式, +其实还有其他方法可以覆盖重写 CSS 样式。你还记得行内样式吗? +
## Instructions -
使用inline style尝试使我们的h1元素变白。请记住,在线条样式中如下所示: <h1 style="color: green;">h1元素上保留blue-textpink-text类。
+
+使用行内样式尝试让h1的字体颜色变白。像下面这样使用: +<h1 style="color: green"> +你的h1元素需继续保留blue-textpink-textclass。 +
## Tests
```yml tests: - - text: 您的h1元素应该具有pink-text类。 - testString: 'assert($("h1").hasClass("pink-text"), "Your h1 element should have the class pink-text.");' - - text: 你的h1元素应该有blue-text 。 - testString: 'assert($("h1").hasClass("blue-text"), "Your h1 element should have the class blue-text.");' - - text: 您的h1元素应具有orange-text的ID。 - testString: 'assert($("h1").attr("id") === "orange-text", "Your h1 element should have the id of orange-text.");' - - text: 为您的h1元素提供内联样式。 - testString: 'assert(document.querySelector("h1[style]"), "Give your h1 element an inline style.");' - - text: 你的h1元素应该是白色的。 - testString: 'assert($("h1").css("color") === "rgb(255, 255, 255)", "Your h1 element should be white.");' + - text: 'h1元素应该包含pink-text class。' + testString: assert($("h1").hasClass("pink-text"), 'h1元素应该包含pink-text class。'); + - text: 'h1元素应该包含blue-text class。' + testString: assert($("h1").hasClass("blue-text"), 'h1元素应该包含blue-text class。'); + - text: 'h1元素应该包含一个名为orange-text的id。' + testString: assert($("h1").attr("id") === "orange-text", 'h1元素应该包含一个名为orange-text的id。'); + - text: 'h1元素应该含有行内样式。' + testString: assert(document.querySelector('h1[style]'), 'h1元素应该含有行内样式。'); + - text: 'h1元素的字体颜色应该为白色。' + testString: assert($("h1").css("color") === "rgb(255, 255, 255)", 'h1元素的字体颜色应该为白色。'); ``` @@ -55,7 +63,6 @@ tests: }

Hello World!

- ``` @@ -67,7 +74,9 @@ tests: ## Solution
-```js +```html // solution required ``` +
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/override-styles-in-subsequent-css.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/override-styles-in-subsequent-css.chinese.md index 94a5ba9053..70e64de087 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/override-styles-in-subsequent-css.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/override-styles-in-subsequent-css.chinese.md @@ -2,29 +2,40 @@ id: bad87fee1348bd9aedf04756 title: Override Styles in Subsequent CSS challengeType: 0 -videoUrl: '' -localeTitle: 覆盖后续CSS中的样式 +videoUrl: 'https://scrimba.com/c/cGJDQug' +forumTopicId: 18253 +localTitle: Class 选择器的优先级高于继承样式 --- ## Description -
我们的“粉红色文本”类覆盖了我们的body元素的CSS声明!我们刚刚证明我们的类将覆盖body元素的CSS。所以下一个合乎逻辑的问题是,我们可以做些什么来覆盖我们的pink-text类?
+
+"pink-text" class 覆盖了body元素的 CSS 声明。 +我们刚刚证明了我们的 class 会覆盖body的 CSS 样式。那么,下一个问题是,我们要怎么样才能覆盖我们的pink-textclass? +
## Instructions -
创建一个名为blue-text的附加CSS类,它为元素提供蓝色。确保它低于pink-text类声明。除了pink-text类之外,将blue-text类应用于h1元素,让我们看看哪个获胜。将多个类属性应用于HTML元素是通过它们之间的空格完成的,如下所示: class="class1 class2"注意:HTML元素中列出的类的顺序无关紧要。但是, <style>部分中的class声明的顺序是重要的。第二个声明将始终优先于第一个声明。因为.blue-text被声明为第二个,所以它会覆盖.pink-text的属性
+
+创建一个字体颜色为blueblue-textCSS class,并确保它在pink-text下方声明。 +在含有pink-textclass 的h1元素里面,再添加一个blue-textclass,这时候,我们将能看到到底是谁获胜。 +HTML 同时应用多个 class 属性需以空格来间隔,例子如下: +class="class1 class2" +注意:HTML 元素里应用的 class 的先后顺序无关紧要。 +但是,在<style>标签里面声明的class顺序十分重要。第二个声明始终优于第一个声明。因为.blue-text.pink-text的后面声明,所以.blue-text会覆盖.pink-text的样式。 +
## Tests
```yml tests: - - text: 您的h1元素应该具有pink-text类。 - testString: 'assert($("h1").hasClass("pink-text"), "Your h1 element should have the class pink-text.");' - - text: 你的h1元素应该有blue-text 。 - testString: 'assert($("h1").hasClass("blue-text"), "Your h1 element should have the class blue-text.");' - - text: blue-textpink-text都应属于同一个h1元素。 - testString: 'assert($(".pink-text").hasClass("blue-text"), "Both blue-text and pink-text should belong to the same h1 element.");' - - text: 你的h1元素应该是蓝色的。 - testString: 'assert($("h1").css("color") === "rgb(0, 0, 255)", "Your h1 element should be blue.");' + - text: 'h1元素应该包含pink-text class。' + testString: assert($("h1").hasClass("pink-text"), 'h1元素应该包含pink-text class。'); + - text: 'h1元素应该包含blue-text class。' + testString: assert($("h1").hasClass("blue-text"), 'h1元素应该包含blue-text class。'); + - text: 'blue-textpink-text需同时应用于h1元素上。' + testString: assert($(".pink-text").hasClass("blue-text"), 'blue-textpink-text需同时应用于h1元素上。'); + - text: 'h1元素的颜色应为蓝色。' + testString: assert($("h1").css("color") === "rgb(0, 0, 255)", 'h1元素的颜色应为蓝色。'); ``` @@ -47,7 +58,6 @@ tests: }

Hello World!

- ``` @@ -59,7 +69,9 @@ tests: ## Solution
-```js +```html // solution required ``` +
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/prioritize-one-style-over-another.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/prioritize-one-style-over-another.chinese.md index 4a6e0da4fe..cebc50c6d5 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/prioritize-one-style-over-another.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/prioritize-one-style-over-another.chinese.md @@ -2,27 +2,35 @@ id: bad87fee1348bd9aedf08756 title: Prioritize One Style Over Another challengeType: 0 -videoUrl: '' -localeTitle: 将一种风格优先于另一种风格 +videoUrl: 'https://scrimba.com/c/cZ8wnHv' +forumTopicId: 18258 +localTitle: 样式中的优先级 --- ## Description -
有时,您的HTML元素将收到多个彼此冲突的样式。例如,您的h1元素不能同时为绿色和粉红色。让我们看看当我们创建一个使文本变为粉红色的类,然后将其应用于元素时会发生什么。我们的类会覆盖 body元素的color: green; CSS属性?
+
+有时候,你的 HTML 元素的样式会跟其他样式发生冲突。 +就像,你的h1元素也不能同时设置greenpink两种样式。 +让我们尝试创建一个字体颜色为pink的 class,并应于用其中一个元素中。猜一猜,它会覆盖body元素设置的color: green;CSS 属性吗? +
## Instructions -
创建一个名为pink-text的CSS类,它为元素提供粉红色。为你的h1元素提供pink-text类。
+
+创建一个能将元素的字体颜色改为pink的CSS class,并起名为pink-text。 +给你的h1元素添加pink-textclass。 +
## Tests
```yml tests: - - text: 您的h1元素应该具有pink-text类。 - testString: 'assert($("h1").hasClass("pink-text"), "Your h1 element should have the class pink-text.");' - - text: 你的<style>应该有一个改变colorpink-text CSS类。 - testString: 'assert(code.match(/\.pink-text\s*\{\s*color\s*:\s*.+\s*;\s*\}/g), "Your <style> should have a pink-text CSS class that changes the color.");' - - text: 你的h1元素应该是粉红色的。 - testString: 'assert($("h1").css("color") === "rgb(255, 192, 203)", "Your h1 element should be pink.");' + - text: 'h1元素应该含有pink-text class。' + testString: assert($("h1").hasClass("pink-text"), 'h1元素应该含有pink-text class。'); + - text: '<style>标签应该含有一个可以改变字体颜色的pink-text class。' + testString: 'assert(code.match(/\.pink-text\s*\{\s*color\s*:\s*.+\s*;\s*\}/g), ''<style>标签应该含有一个可以改变字体颜色的pink-text class。'');' + - text: 'h1元素的字体颜色应该为pink(粉色)。' + testString: assert($("h1").css("color") === "rgb(255, 192, 203)", 'h1元素的字体颜色应该为pink(粉色)。'); ``` @@ -42,7 +50,6 @@ tests: }

Hello World!

- ``` @@ -57,4 +64,6 @@ tests: ```js // solution required ``` +
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/set-the-font-family-of-an-element.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/set-the-font-family-of-an-element.chinese.md index 0950b69a2b..ef16079fe6 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/set-the-font-family-of-an-element.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/set-the-font-family-of-an-element.chinese.md @@ -2,23 +2,36 @@ id: bad87fee1348bd9aede08807 title: Set the Font Family of an Element challengeType: 0 -videoUrl: '' -localeTitle: 设置元素的字体系列 +videoUrl: 'https://scrimba.com/c/c3bvpCg' +forumTopicId: 18278 +localTitle: 设置元素的字体家族 --- ## Description -
您可以使用font-family属性设置元素应使用的font-family 。例如,如果要将h2元素的字体设置为sans-serif ,则可以使用以下CSS:
h2 {
font-family:sans-serif;
}
+
+通过font-family属性,可以设置元素里面的字体样式。 +如果你想设置h2元素的字体为sans-serif,你可以用以下的 CSS 规则: + +```css +h2 { + font-family: sans-serif; +} +``` + +
## Instructions -
使所有p元素都使用monospace字体。
+
+确保p元素使用monospace字体。 +
## Tests
```yml tests: - - text: 你的p元素应该使用字体monospace 。 - testString: 'assert($("p").not(".red-text").css("font-family").match(/monospace/i), "Your p elements should use the font monospace.");' + - text: 'p元素应该使用monospace字体。' + testString: assert($("p").not(".red-text").css("font-family").match(/monospace/i), 'p元素应该使用monospace字体。'); ``` @@ -42,36 +55,35 @@ tests:

CatPhotoApp

-

Click here to view more cat photos.

- - A cute orange cat lying on its back. - +

点击查看更多猫图.

+ + 一只仰卧着的萌猫 +
-

Things cats love:

+

猫咪最喜欢的三件东西:

    -
  • cat nip
  • -
  • laser pointers
  • -
  • lasagna
  • +
  • 猫薄荷
  • +
  • 激光笔
  • +
  • 千层饼
-

Top 3 things cats hate:

+

猫咪最讨厌的三件东西:

    -
  1. flea treatment
  2. -
  3. thunder
  4. -
  5. other cats
  6. +
  7. 跳蚤
  8. +
  9. 打雷
  10. +
  11. 同类
- +
- -
- - -
- - + +
+ + +
+ +
- ``` @@ -83,7 +95,9 @@ tests: ## Solution
-```js +```html // solution required ``` +
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/set-the-id-of-an-element.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/set-the-id-of-an-element.chinese.md index 7f34ba5ea2..0519527788 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/set-the-id-of-an-element.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/set-the-id-of-an-element.chinese.md @@ -2,23 +2,32 @@ id: bad87eee1348bd9aede07836 title: Set the id of an Element challengeType: 0 -videoUrl: '' -localeTitle: 设置元素的id +videoUrl: 'https://scrimba.com/c/cN6MEc2' +forumTopicId: 18279 +localTitle: 设置元素的 id --- ## Description -
除了类之外,每个HTML元素还可以具有id属性。使用id属性有几个好处:您可以使用id来设置单个元素的样式,稍后您将学习如何使用它来使用JavaScript选择和修改特定元素。 id属性应该是唯一的。浏览器不会强制执行此操作,但这是广泛认可的最佳实践。所以请不要给多个元素赋予相同的id属性。这里有一个例子,说明如何为你的h2元素提供cat-photo-app <h2 id="cat-photo-app"><h2 id="cat-photo-app">
+
+除了class属性,每一个 HTML 元素也都有id属性。 +使用id有几个好处:你可以通过id选择器来改变单个元素的样式,稍后的课程中,你也会了解到在 JavaScript 里面,可以通过id来选择元素和操作元素。 +id属性应是唯一的。浏览器不强迫执行这规范,但是这是广泛认可的最佳实践。所以,请不要给多个元素设置相同的id属性。 +设置h2元素的 id 为cat-photo-app的方法如下: +<h2 id="cat-photo-app"> +
## Instructions -
form元素添加id cat-photo-form
+
+设置form元素的 id 为cat-photo-form。 +
## Tests
```yml tests: - - text: 为form元素添加cat-photo-form的id。 - testString: 'assert($("form").attr("id") === "cat-photo-form", "Give your form element the id of cat-photo-form.");' + - text: '你的form元素的 id 应为cat-photo-form。' + testString: assert($("form").attr("id") === "cat-photo-form", '你的form元素的 id 应为cat-photo-form。'); ``` @@ -63,36 +72,35 @@ tests:

CatPhotoApp

-

Click here to view more cat photos.

- - A cute orange cat lying on its back. - +

点击查看更多猫图.

+ + 一只仰卧着的萌猫 +
-

Things cats love:

+

猫咪最喜欢的三件东西:

    -
  • cat nip
  • -
  • laser pointers
  • -
  • lasagna
  • +
  • 猫薄荷
  • +
  • 激光笔
  • +
  • 千层饼
-

Top 3 things cats hate:

+

猫咪最讨厌的三件东西:

    -
  1. flea treatment
  2. -
  3. thunder
  4. -
  5. other cats
  6. +
  7. 跳蚤
  8. +
  9. 打雷
  10. +
  11. 同类
- +
- -
- - -
- - + +
+ + +
+ +
- ``` @@ -104,7 +112,8 @@ tests: ## Solution
-```js +```html // solution required ```
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/size-your-images.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/size-your-images.chinese.md index c1a63c83af..87842418a7 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/size-your-images.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/size-your-images.chinese.md @@ -2,25 +2,41 @@ id: bad87fee1348bd9acdf08812 title: Size Your Images challengeType: 0 -videoUrl: '' -localeTitle: 调整图像大小 +videoUrl: 'https://scrimba.com/c/cM9MmCP' +forumTopicId: 18282 +localTitle: 调整图片的大小 --- ## Description -
CSS有一个名为width的属性,用于控制元素的宽度。就像字体一样,我们将使用px (像素)来指定图像的宽度。例如,如果我们想要创建一个名为larger-image的CSS类,它给HTML元素的宽度为500像素,我们将使用:
<风格>
.larger-image {
宽度:500px;
}
</样式>
+
+CSS 的width属性可以控制元素的宽度。图片的width宽度类似于字体的px(像素)值。 +假如,你想创建一个叫larger-image的 CSS class 来控制 HTML 元素的宽度为 500px,我们可以这样做: + +```html + +``` + +
## Instructions -
创建一个名为smaller-image的类,并使用它来调整图像大小,使其只有100像素宽。 注意
由于浏览器实现的差异,您可能需要100%缩放才能通过此挑战的测试。
+
+创建一个smaller-image的 CSS class,设置图片的宽度为 100px。 +注意:
由于不同浏览器的差异性,你可能需要将浏览器缩放到 100% 来通过该挑战。 +
## Tests
```yml tests: - - text: 您的img元素应该具有smaller-image类。 - testString: 'assert($("img[src="https://bit.ly/fcc-relaxing-cat"]").attr("class") === "smaller-image", "Your img element should have the class smaller-image.");' - - text: 您的图片应为100像素宽。浏览器缩放应为100%。 - testString: 'assert($("img").width() === 100, "Your image should be 100 pixels wide. Browser zoom should be at 100%.");' + - text: 'img元素应该含有smaller-image class。' + testString: 'assert($("img[src=''https://bit.ly/fcc-relaxing-cat'']").attr(''class'') === "smaller-image", ''img元素应该含有smaller-image class。'');' + - text: '图片宽度应为 100px(像素),且浏览器缩放应为默认 100%。' + testString: assert($("img").width() === 100, '你的图片应为 100px(像素),且浏览器缩放应为默认 100%。'); ``` @@ -50,36 +66,35 @@ tests:

CatPhotoApp

-

Click here to view more cat photos.

- - A cute orange cat lying on its back. - +

点击查看更多猫图.

+ + 一只仰卧着的萌猫 +
-

Things cats love:

+

猫咪最喜欢的三件东西:

    -
  • cat nip
  • -
  • laser pointers
  • -
  • lasagna
  • +
  • 猫薄荷
  • +
  • 激光笔
  • +
  • 千层饼
-

Top 3 things cats hate:

+

猫咪最讨厌的三件东西:

    -
  1. flea treatment
  2. -
  3. thunder
  4. -
  5. other cats
  6. +
  7. 跳蚤
  8. +
  9. 打雷
  10. +
  11. 同类
- +
- -
- - -
- - + +
+ + +
+ +
- ``` @@ -92,56 +107,7 @@ tests:
```js - - - -

CatPhotoApp

-
-

Click here to view more cat photos.

- - A cute orange cat lying on its back. - -
-

Things cats love:

-
    -
  • cat nip
  • -
  • laser pointers
  • -
  • lasagna
  • -
-

Top 3 things cats hate:

-
    -
  1. flea treatment
  2. -
  3. thunder
  4. -
  5. other cats
  6. -
-
- -
- -
- - -
- - -
-
+// solution required ```
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/specify-how-fonts-should-degrade.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/specify-how-fonts-should-degrade.chinese.md index 4d1d7c342a..893306b704 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/specify-how-fonts-should-degrade.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/specify-how-fonts-should-degrade.chinese.md @@ -2,29 +2,46 @@ id: bad87fee1348bd9aedf08808 title: Specify How Fonts Should Degrade challengeType: 0 -videoUrl: '' -localeTitle: 指定字体应如何降级 +videoUrl: 'https://scrimba.com/c/cpVKBfQ' +forumTopicId: 18304 +localTitle: 字体如何优雅降级 --- ## Description -
所有浏览器都有几种默认字体。这些通用字体系列包括monospaceserifsans-serif当一个字体不可用时,您可以告诉浏览器“降级”为另一种字体。例如,如果您希望元素使用Helvetica字体,但在Helvetica不可用时降级为sans-serif字体,则将按如下方式指定:
p {
font-family:Helvetica,sans-serif;
}
通用字体系列名称不区分大小写。此外,它们不需要引号,因为它们是CSS关键字。
+
+所有浏览器都有几种默认字体。这些通用字体包括monospaceserifsans-serif。 +当字体不可用,你可以告诉浏览器通过 “降级” 去使用其他字体。 +例如,如果你想将一个元素的字体设置成Helvetica,当Helvetica不可用时,降级使用sans-serif字体,那么可以这样写: + +```css +p { + font-family: Helvetica, sans-serif; +} +``` + +通用字体名字不区分大小写。同时,也不需要使用引号,因为它们是 CSS 关键字。 +
## Instructions -
首先,将monospace字体应用于h2元素,以便它现在有两种字体 - Lobstermonospace字体。在上一个挑战中,您使用link标记导入了Lobster字体。现在注释掉谷歌字体导入的Lobster字体(使用之前学过的HTML评论),以便它不再可用。注意你的h2元素如何降级为monospace字体。 注意
如果您的计算机上安装了Lobster字体,您将看不到降级,因为您的浏览器能够找到该字体。
+
+首先,添加monospace字体到h2元素里,它现在拥有着Lobstermonospace两种字体。 +在上一个挑战里,你已经通过link标签引入谷歌Lobster字体。现在让我们注释掉谷歌Lobster字体的引入(使用我们之前学过的HTML注释),使字体失效。你会发现你的h2元素降级到了monospace字体。 +注意:
如果你的电脑已经安装了Lobster字体,你将看不到这个降级过程,因为你的浏览器会找到该字体。 +
## Tests
```yml tests: - - text: 你的h2元素应该使用字体Lobster 。 - testString: 'assert($("h2").css("font-family").match(/^"?lobster/i), "Your h2 element should use the font Lobster.");' - - text: 当Lobster不可用时,你的h2元素会降级为monospace字体。 - testString: 'assert(/\s*h2\s*\{\s*font-family\:\s*(\"|")?Lobster(\"|")?,\s*monospace\s*;\s*\}/gi.test(code), "Your h2 element should degrade to the font monospace when Lobster is not available.");' - - text: 通过在其前面放置<!--来注释您对Google的Lobster字体的调用。 - testString: 'assert(new RegExp("", "gi").test(code), "Be sure to close your comment by adding -->.");' + - text: 'h2元素应该含有Lobster字体。' + testString: assert($("h2").css("font-family").match(/^"?lobster/i), 'h2元素应该含有Lobster字体。'); + - text: '当Lobster字体失效时,h2元素应该降级使用monospace字体。' + testString: 'assert(/\s*h2\s*\{\s*font-family\:\s*(\''|")?Lobster(\''|")?,\s*monospace\s*;\s*\}/gi.test(code), ''当Lobster字体失效时,h2元素应该降级使用monospace字体。'');' + - text: '通过添加<!--,注释掉谷歌Lobster字体的引入。' + testString: assert(new RegExp("", "gi").test(code), '确保注释要以-->结束。'); ``` @@ -54,36 +71,35 @@ tests:

CatPhotoApp

-

Click here to view more cat photos.

- - A cute orange cat lying on its back. - +

点击查看更多猫图.

+ + 一只仰卧着的萌猫 +
-

Things cats love:

+

猫咪最喜欢的三件东西:

    -
  • cat nip
  • -
  • laser pointers
  • -
  • lasagna
  • +
  • 猫薄荷
  • +
  • 激光笔
  • +
  • 千层饼
-

Top 3 things cats hate:

+

猫咪最讨厌的三件东西:

    -
  1. flea treatment
  2. -
  3. thunder
  4. -
  5. other cats
  6. +
  7. 跳蚤
  8. +
  9. 打雷
  10. +
  11. 同类
- +
- -
- - -
- - + +
+ + +
+ +
- ``` @@ -95,7 +111,9 @@ tests: ## Solution
-```js +```html // solution required ``` +
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/style-multiple-elements-with-a-css-class.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/style-multiple-elements-with-a-css-class.chinese.md index e5f927bd9d..124de7fcc7 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/style-multiple-elements-with-a-css-class.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/style-multiple-elements-with-a-css-class.chinese.md @@ -2,15 +2,19 @@ id: bad87fee1348bd9aefe08806 title: Style Multiple Elements with a CSS Class challengeType: 0 -videoUrl: '' -localeTitle: 使用CSS类设置多个元素的样式 +videoUrl: 'https://scrimba.com/c/cRkVbsQ' +forumTopicId: 18311 +localTitle: 使用 class 选择器设置多个元素的样式 --- ## Description -
类允许您在多个HTML元素上使用相同的CSS样式。您可以通过将red-text类应用于第一个p元素来查看。
+
+通过 CSS class 选择器,多个 HTML 元素可以使用相同的 CSS 样式规则。你可以将red-textclass 选择器应用在第一个p元素上。 +
## Instructions -
+
+
## Tests @@ -18,16 +22,16 @@ localeTitle: 使用CSS类设置多个元素的样式 ```yml tests: - - text: 你的h2元素应该是红色的。 - testString: 'assert($("h2").css("color") === "rgb(255, 0, 0)", "Your h2 element should be red.");' - - text: 你的h2元素应该有red-text类。 - testString: 'assert($("h2").hasClass("red-text"), "Your h2 element should have the class red-text.");' - - text: 你的第一个p元素应该是红色的。 - testString: 'assert($("p:eq(0)").css("color") === "rgb(255, 0, 0)", "Your first p element should be red.");' - - text: 你的第二和第三个p元素不应该是红色的。 - testString: 'assert(!($("p:eq(1)").css("color") === "rgb(255, 0, 0)") && !($("p:eq(2)").css("color") === "rgb(255, 0, 0)"), "Your second and third p elements should not be red.");' - - text: 你的第一个p元素应该有red-text类。 - testString: 'assert($("p:eq(0)").hasClass("red-text"), "Your first p element should have the class red-text.");' + - text: 'h2元素应该是红色的。' + testString: assert($("h2").css("color") === "rgb(255, 0, 0)", 'h2元素应该是红色的。'); + - text: 'h2元素应该含有red-text class 选择器。' + testString: assert($("h2").hasClass("red-text"), 'h2元素应该含有red-text class 选择器。'); + - text: '第一个p元素应该为红色。' + testString: 'assert($("p:eq(0)").css("color") === "rgb(255, 0, 0)", ''第一个p元素应该为红色。'');' + - text: '第二和第三个p元素不应该为红色。' + testString: 'assert(!($("p:eq(1)").css("color") === "rgb(255, 0, 0)") && !($("p:eq(2)").css("color") === "rgb(255, 0, 0)"), ''第二和第三个p元素不应该为红色。'');' + - text: '第一个p元素应该包含red-text class 选择器。' + testString: 'assert($("p:eq(0)").hasClass("red-text"), ''第一个p元素应该包含red-text class 选择器。'');' ``` @@ -47,36 +51,35 @@ tests:

CatPhotoApp

-

Click here to view more cat photos.

- - A cute orange cat lying on its back. - +

点击查看更多猫图.

+ + 一只仰卧着的萌猫 +
-

Things cats love:

+

猫咪最喜欢的三件东西:

    -
  • cat nip
  • -
  • laser pointers
  • -
  • lasagna
  • +
  • 猫薄荷
  • +
  • 激光笔
  • +
  • 千层饼
-

Top 3 things cats hate:

+

猫咪最讨厌的三件东西:

    -
  1. flea treatment
  2. -
  3. thunder
  4. -
  5. other cats
  6. +
  7. 跳蚤
  8. +
  9. 打雷
  10. +
  11. 同类
- +
- -
- - -
- - + +
+ + +
+ +
- ``` @@ -88,7 +91,9 @@ tests: ## Solution
-```js +```html // solution required ``` +
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/style-the-html-body-element.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/style-the-html-body-element.chinese.md index d1652faf75..7c8dd1b185 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/style-the-html-body-element.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/style-the-html-body-element.chinese.md @@ -2,27 +2,41 @@ id: bad87fee1348bd9aedf08736 title: Style the HTML Body Element challengeType: 0 -videoUrl: '' -localeTitle: 设置HTML Body Element的样式 +videoUrl: 'https://scrimba.com/c/cB77PHW' +forumTopicId: 18313 +localTitle: 给 HTML 的 Body 元素添加样式 --- ## Description -
现在让我们重新开始讨论CSS继承。每个HTML页面都有一个body元素。
+
+现在让我们来讨论一下 CSS 继承。 +每一个 HTML 页面都含有一个body元素。 +
## Instructions -
我们可以通过给它一个黑色的background-color来证明body元素存在。我们可以通过在style元素中添加以下内容来实现:
身体 {
背景颜色:黑色;
}
+
+我们可以通过设置background-colorblack,来证明body元素的存在。 +添加以下的代码到style标签里面: + +```css +body { + background-color: black; +} +``` + +
## Tests
```yml tests: - - text: 给你的body元素黑色的background-color 。 - testString: 'assert($("body").css("background-color") === "rgb(0, 0, 0)", "Give your body element the background-color of black.");' - - text: 确保您的CSS规则使用左右大括号正确格式化。 - testString: 'assert(code.match(/ - ``` @@ -49,7 +62,9 @@ tests: ## Solution
-```js +```html // solution required ``` +
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/understand-absolute-versus-relative-units.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/understand-absolute-versus-relative-units.chinese.md index 8601072688..597c95bdc4 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/understand-absolute-versus-relative-units.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/understand-absolute-versus-relative-units.chinese.md @@ -2,25 +2,33 @@ id: bad82fee1322bd9aedf08721 title: Understand Absolute versus Relative Units challengeType: 0 -videoUrl: '' -localeTitle: 了解绝对与相对单位 +videoUrl: 'https://scrimba.com/c/cN66JSL' +forumTopicId: 301089 +localTitle: 理解绝对单位与相对单位 --- ## Description -
最后几个挑战都设置元素的边距或填充像素( px )。像素是一种长度单位,它告诉浏览器如何调整项目的大小或空间。除了px ,CSS还有许多不同的长度单位选项供您使用。两种主要类型的长度单位是绝对的和相对的。绝对单位与长度的物理单位相关联。例如, inmm表示英寸和毫米。绝对长度单位接近屏幕上的实际测量值,但根据屏幕的分辨率存在一些差异。相对单位,例如emrem ,相对于另一个长度值。例如, em基于元素字体的大小。如果您使用它来设置font-size属性本身,则它相对于父级的font-size注意
有几个相对单位选项与视口的大小相关联。它们包含在响应式Web设计原则部分中。
+
+最近的几个挑战都是设置元素的内边距和外边距的px值。像素px是一种长度单位,来告诉浏览器应该如何调整元素大小和空间大小。其实除了像素,CSS 也有其他不同的长度单位供我们使用。 +单位长度的类型可以分成 2 种,一种是相对的,一种是绝对的。例如,inmm分别代表着英寸和毫米。绝对长度单位会接近屏幕上的实际测量值,不过不同屏幕的分辨率会存在差异,可能会导致一些误差。 +相对单位长度,就像emrem,它们会依赖其他长度的值。就好像em的大小基于元素的字体的font-size值,如果你使用em单位来设置font-size值,它的值会跟随父元素的font-size值来改变。 +注意:
有些单位长度选项是相对视窗大小来改变值的,符合了响应式 web 的设计原则。 +
## Instructions -
使用类red-box向元素添加padding属性并将其设置为1.5em
+
+给red-box class 添加padding属性,并设置为1.5em。 +
## Tests
```yml tests: - - text: 你的red-box类应该有一个padding属性。 - testString: 'assert($(".red-box").css("padding-top") != "0px" && $(".red-box").css("padding-right") != "0px" && $(".red-box").css("padding-bottom") != "0px" && $(".red-box").css("padding-left") != "0px", "Your red-box class should have a padding property.");' - - text: 你的red-box类应该给出1.5em的padding元素。 - testString: 'assert(code.match(/\.red-box\s*?{\s*?.*?\s*?.*?\s*?padding:\s*?1\.5em/gi), "Your red-box class should give elements 1.5em of padding.");' + - text: 'red-box class 应该含有padding属性。' + testString: assert($('.red-box').css('padding-top') != '0px' && $('.red-box').css('padding-right') != '0px' && $('.red-box').css('padding-bottom') != '0px' && $('.red-box').css('padding-left') != '0px', 'red-box class 应该含有padding属性。'); + - text: 'red-box class 的padding值应为 1.5em。' + testString: 'assert(code.match(/\.red-box\s*?{\s*?.*?\s*?.*?\s*?padding:\s*?1\.5em/gi), ''red-box class 的padding值应为 1.5em。'');' ``` @@ -53,12 +61,12 @@ tests: .red-box { background-color: red; margin: 20px 40px 20px 40px; - + } .green-box { background-color: green; - margin: 20px 40px 20px 40px; + margin: 40px 20px 20px 40px; }
margin
@@ -67,7 +75,6 @@ tests:
padding
padding
- ``` @@ -79,7 +86,9 @@ tests: ## Solution
-```js +```html // solution required ``` +
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-a-css-class-to-style-an-element.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-a-css-class-to-style-an-element.chinese.md index 3381129041..0b0152e130 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-a-css-class-to-style-an-element.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-a-css-class-to-style-an-element.chinese.md @@ -2,29 +2,49 @@ id: bad87fee1348bd9aecf08806 title: Use a CSS Class to Style an Element challengeType: 0 -videoUrl: '' -localeTitle: 使用CSS类来设置元素的样式 +videoUrl: 'https://scrimba.com/c/c2MvDtV' +forumTopicId: 18337 +localTitle: 使用 class 选择器设置单个元素的样式 --- ## Description -
类是可重用的样式,可以添加到HTML元素中。这是一个CSS类声明示例:
<风格>
.blue-text {
颜色:蓝色;
}
</样式>
您可以看到我们在<style>标记内创建了一个名为blue-text的CSS类。您可以将类应用于HTML元素,如下所示: <h2 class="blue-text">CatPhotoApp</h2>请注意,在CSS style元素中,类名以句点开头。在HTML元素的class属性中,类名不包含句点。
+
+CSS 的class具有可重用性,可应用于各种 HTML 元素。 +一个 CSSclass声明示例,如下所示: + +```html + +``` + +可以看到,我们在<style>样式声明区域里,创建了一个名为blue-textclass选择器。 +你可以将 CSSclass选择器应用到一个HTML元素里,如下所示: +<h2 class="blue-text">CatPhotoApp</h2> +注意:在style样式区域声明里,class需以.开头。而在 HTML 元素里,class属性的前面不能添加.。 +
## Instructions -
style元素中,将h2选择器更改为.red-text并将颜色的值从blue更新为red 。为您的h2元素提供值为'red-text'class属性。
+
+在style样式声明里,把h2元素选择器改为.red-textclass 选择器,同时将颜色blue变为red。 +在h2元素里,添加一个class属性,且值为'red-text'。 +
## Tests
```yml tests: - - text: 你的h2元素应该是红色的。 - testString: 'assert($("h2").css("color") === "rgb(255, 0, 0)", "Your h2 element should be red.");' - - text: 你的h2元素应该有red-text类。 - testString: 'assert($("h2").hasClass("red-text"), "Your h2 element should have the class red-text.");' - - text: 样式表应声明一个red-text类,并将其颜色设置为红色。 - testString: 'assert(code.match(/\.red-text\s*\{\s*color\s*:\s*red;\s*\}/g), "Your stylesheet should declare a red-text class and have its color set to red.");' - - text: '不要在h2元素中使用style="color: red"内联样式声明。' - testString: 'assert($("h2").attr("style") === undefined, "Do not use inline style declarations like style="color: red" in your h2 element.");' + - text: 'h2元素应该为红色。' + testString: assert($("h2").css("color") === "rgb(255, 0, 0)", 'h2元素应该为红色。'); + - text: 'h2元素应含有red-text class 选择器。' + testString: assert($("h2").hasClass("red-text"), 'h2元素应含有red-text class 选择器。'); + - text: 'style样式声明区域里应该包含一个red-text class 选择器,并且它的颜色应为红色。' + testString: 'assert(code.match(/\.red-text\s*\{\s*color\s*:\s*red;\s*\}/g), ''style样式声明区域里应该包含一个red-text class 选择器,并且它的颜色应为红色。'');' + - text: '不要在h2元素里使用行内样式:style="color: red"。' + testString: assert($("h2").attr("style") === undefined, '不要在h2元素里使用行内样式:style="color: red"。'); ``` @@ -44,36 +64,35 @@ tests:

CatPhotoApp

-

Click here to view more cat photos.

- - A cute orange cat lying on its back. - +

点击查看更多猫图.

+ + 一只仰卧着的萌猫 +
-

Things cats love:

+

猫咪最喜欢的三件东西:

    -
  • cat nip
  • -
  • laser pointers
  • -
  • lasagna
  • +
  • 猫薄荷
  • +
  • 激光笔
  • +
  • 千层饼
-

Top 3 things cats hate:

+

猫咪最讨厌的三件东西:

    -
  1. flea treatment
  2. -
  3. thunder
  4. -
  5. other cats
  6. +
  7. 跳蚤
  8. +
  9. 打雷
  10. +
  11. 同类
- +
- -
- - -
- - + +
+ + +
+ +
- ``` @@ -85,7 +104,8 @@ tests: ## Solution
-```js +```html // solution required ```
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-a-custom-css-variable.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-a-custom-css-variable.chinese.md index 49ccb666b5..aff9f84cbb 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-a-custom-css-variable.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-a-custom-css-variable.chinese.md @@ -2,29 +2,41 @@ id: 5a9d727a424fe3d0e10cad12 title: Use a custom CSS Variable challengeType: 0 -videoUrl: '' -localeTitle: 使用自定义CSS变量 +videoUrl: 'https://scrimba.com/c/cM989ck' +forumTopicId: 301090 +localTitle: 使用一个自定义的 CSS 变量 --- ## Description -
创建变量后,可以通过引用您提供的名称将其值分配给其他CSS属性。
背景:var( - penguin-skin);
这会将您要定位的任何元素的背景更改为灰色,因为这是--penguin-skin变量的值。请注意,除非变量名称完全匹配,否则不会应用样式。
+
+创建变量后,CSS 属性可以通过引用变量名来使用它的值。 + +```css +background: var(--penguin-skin); +``` + +因为引用了--penguin-skin变量的值,使用了这个样式的元素背景颜色会是灰色。 +注意:如果变量名不匹配,样式不会生效。 +
## Instructions -
--penguin-skin变量应用于penguin-toppenguin-bottomright-handleft-hand类的background属性。
+
+penguin-toppenguin-bottomright-handleft-handclass 的background属性均使用--penguin-skin变量值。 +
## Tests
```yml tests: - - text: 将--penguin-skin变量应用于penguin-top类的background属性。 - testString: 'assert(code.match(/.penguin-top\s*?{[\s\S]*background\s*?:\s*?var\s*?\(\s*?--penguin-skin\s*?\)\s*?;[\s\S]*}[\s\S]*.penguin-bottom\s{/gi), "Apply the --penguin-skin variable to the background property of the penguin-top class.");' - - text: 将--penguin-skin变量应用于penguin-bottom类的background属性。 - testString: 'assert(code.match(/.penguin-bottom\s*?{[\s\S]*background\s*?:\s*?var\s*?\(\s*?--penguin-skin\s*?\)\s*?;[\s\S]*}[\s\S]*.right-hand\s{/gi), "Apply the --penguin-skin variable to the background property of the penguin-bottom class.");' - - text: 将--penguin-skin变量应用于right-hand类的background属性。 - testString: 'assert(code.match(/.right-hand\s*?{[\s\S]*background\s*?:\s*?var\s*?\(\s*?--penguin-skin\s*?\)\s*?;[\s\S]*}[\s\S]*.left-hand\s{/gi), "Apply the --penguin-skin variable to the background property of the right-hand class.");' - - text: 将--penguin-skin变量应用于left-hand类的background属性。 - testString: 'assert(code.match(/.left-hand\s*?{[\s\S]*background\s*?:\s*?var\s*?\(\s*?--penguin-skin\s*?\)\s*?;[\s\S]*}/gi), "Apply the --penguin-skin variable to the background property of the left-hand class.");' + - text: 'penguin-top class 的background属性应使用--penguin-skin变量值。' + testString: 'assert(code.match(/.penguin-top\s*?{[\s\S]*background\s*?:\s*?var\s*?\(\s*?--penguin-skin\s*?\)\s*?;[\s\S]*}[\s\S]*.penguin-bottom\s{/gi), ''penguin-top class 的background属性应使用--penguin-skin变量值。'');' + - text: 'penguin-bottom class 的background属性应使用--penguin-skin变量值。' + testString: 'assert(code.match(/.penguin-bottom\s*?{[\s\S]*background\s*?:\s*?var\s*?\(\s*?--penguin-skin\s*?\)\s*?;[\s\S]*}[\s\S]*.right-hand\s{/gi), ''penguin-bottom class 的background属性应使用--penguin-skin变量值。'');' + - text: 'right-hand class 的background属性应使用--penguin-skin变量值。' + testString: 'assert(code.match(/.right-hand\s*?{[\s\S]*background\s*?:\s*?var\s*?\(\s*?--penguin-skin\s*?\)\s*?;[\s\S]*}[\s\S]*.left-hand\s{/gi), ''right-hand class 的background属性应使用--penguin-skin变量值。'');' + - text: 'left-hand class 的background属性应使用--penguin-skin变量值。' + testString: 'assert(code.match(/.left-hand\s*?{[\s\S]*background\s*?:\s*?var\s*?\(\s*?--penguin-skin\s*?\)\s*?;[\s\S]*}/gi), ''left-hand class 的background属性应使用--penguin-skin变量值。'');' ``` @@ -46,63 +58,63 @@ tests: width: 300px; height: 300px; } - + .penguin-top { top: 10%; left: 25%; - + /* change code below */ background: black; /* change code above */ - + width: 50%; height: 45%; border-radius: 70% 70% 60% 60%; } - + .penguin-bottom { top: 40%; left: 23.5%; - + /* change code below */ background: black; /* change code above */ - + width: 53%; height: 45%; border-radius: 70% 70% 100% 100%; } - + .right-hand { top: 0%; left: -5%; - + /* change code below */ background: black; /* change code above */ - + width: 30%; height: 60%; border-radius: 30% 30% 120% 30%; transform: rotate(45deg); z-index: -1; } - + .left-hand { top: 0%; left: 75%; - + /* change code below */ background: black; /* change code above */ - + width: 30%; height: 60%; border-radius: 30% 30% 30% 120%; transform: rotate(-45deg); z-index: -1; } - + .right-cheek { top: 15%; left: 35%; @@ -111,7 +123,7 @@ tests: height: 70%; border-radius: 70% 70% 60% 60%; } - + .left-cheek { top: 15%; left: 5%; @@ -120,7 +132,7 @@ tests: height: 70%; border-radius: 70% 70% 60% 60%; } - + .belly { top: 60%; left: 2.5%; @@ -129,7 +141,7 @@ tests: height: 100%; border-radius: 120% 120% 100% 100%; } - + .right-feet { top: 85%; left: 60%; @@ -138,9 +150,9 @@ tests: height: 30%; border-radius: 50% 50% 50% 50%; transform: rotate(-80deg); - z-index: -2222; + z-index: -2222; } - + .left-feet { top: 85%; left: 25%; @@ -149,18 +161,18 @@ tests: height: 30%; border-radius: 50% 50% 50% 50%; transform: rotate(80deg); - z-index: -2222; + z-index: -2222; } - + .right-eye { top: 45%; left: 60%; background: black; width: 15%; height: 17%; - border-radius: 50%; + border-radius: 50%; } - + .left-eye { top: 45%; left: 25%; @@ -169,7 +181,7 @@ tests: height: 17%; border-radius: 50%; } - + .sparkle { top: 25%; left: 15%; @@ -178,7 +190,7 @@ tests: height: 35%; border-radius: 50%; } - + .blush-right { top: 65%; left: 15%; @@ -187,7 +199,7 @@ tests: height: 10%; border-radius: 50%; } - + .blush-left { top: 65%; left: 70%; @@ -196,7 +208,7 @@ tests: height: 10%; border-radius: 50%; } - + .beak-top { top: 60%; left: 40%; @@ -205,7 +217,7 @@ tests: height: 10%; border-radius: 50%; } - + .beak-bottom { top: 65%; left: 42%; @@ -214,11 +226,11 @@ tests: height: 10%; border-radius: 50%; } - + body { background:#c6faf1; } - + .penguin * { position: absolute; } @@ -246,19 +258,18 @@ tests:
- ``` - - -
## Solution
+ ```js // solution required ``` +
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-a-media-query-to-change-a-variable.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-a-media-query-to-change-a-variable.chinese.md index 7270af3075..c5f0abdd06 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-a-media-query-to-change-a-variable.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-a-media-query-to-change-a-variable.chinese.md @@ -2,25 +2,31 @@ id: 5a9d72ad424fe3d0e10cad16 title: Use a media query to change a variable challengeType: 0 -videoUrl: '' -localeTitle: 使用媒体查询更改变量 +videoUrl: 'https://scrimba.com/c/cWmL8UP' +forumTopicId: 301091 +localTitle: 使用媒体查询更改变量 --- ## Description -
CSS变量可以简化您使用媒体查询的方式。例如,当您的屏幕小于或大于媒体查询断点时,您可以更改变量的值,并且无论在何处使用它都将应用其样式。
+
+CSS 变量可以简化媒体查询的方式。 +例如,当屏幕小于或大于媒体查询所设置的值,通过改变变量的值,那么应用了变量的元素样式都会得到响应修改。 +
## Instructions -
media query:root选择器中,对其进行更改,以便重新定义--penguin-size并赋值为200px 。此外,重新定义--penguin-skin并赋予其black值。然后调整预览大小以查看此更改的操作。
+
+在media query(媒体查询)声明的:root选择器里,重定义--penguin-size的值为 200px,且重定义--penguin-skin的值为black,然后通过缩放页面来查看是否生效。 +
## Tests
```yml tests: - - text: ':root应该将--penguin-size变量重新分配给200px 。' - testString: 'assert(code.match(/media\s*?\(\s*?max-width\s*?:\s*?350px\s*?\)\s*?{[\s\S]*:root\s*?{[\s\S]*--penguin-size\s*?:\s*?200px\s*?;[\s\S]*}[\s\S]*}/gi), ":root should reassign the --penguin-size variable to 200px.");' - - text: ':root应该将--penguin-skin变量重新分配给black 。' - testString: 'assert(code.match(/media\s*?\(\s*?max-width\s*?:\s*?350px\s*?\)\s*?{[\s\S]*:root\s*?{[\s\S]*--penguin-skin\s*?:\s*?black\s*?;[\s\S]*}[\s\S]*}/gi), ":root should reassign the --penguin-skin variable to black.");' + - text: ':root中的--penguin-size值应为200px。' + testString: 'assert(code.match(/media\s*?\(\s*?max-width\s*?:\s*?350px\s*?\)\s*?{[\s\S]*:root\s*?{[\s\S]*--penguin-size\s*?:\s*?200px\s*?;[\s\S]*}[\s\S]*}/gi), '':root中的--penguin-size值应为200px。'');' + - text: ':root中的--penguin-skin值应为black。' + testString: 'assert(code.match(/media\s*?\(\s*?max-width\s*?:\s*?350px\s*?\)\s*?{[\s\S]*:root\s*?{[\s\S]*--penguin-skin\s*?:\s*?black\s*?;[\s\S]*}[\s\S]*}/gi), '':root中的--penguin-skin值应为black。'');' ``` @@ -39,17 +45,17 @@ tests: --penguin-belly: white; --penguin-beak: orange; } - + @media (max-width: 350px) { :root { - + /* add code below */ - + /* add code above */ - + } } - + .penguin { position: relative; margin: auto; @@ -58,7 +64,7 @@ tests: width: var(--penguin-size, 300px); height: var(--penguin-size, 300px); } - + .right-cheek { top: 15%; left: 35%; @@ -67,7 +73,7 @@ tests: height: 70%; border-radius: 70% 70% 60% 60%; } - + .left-cheek { top: 15%; left: 5%; @@ -76,7 +82,7 @@ tests: height: 70%; border-radius: 70% 70% 60% 60%; } - + .belly { top: 60%; left: 2.5%; @@ -85,7 +91,7 @@ tests: height: 100%; border-radius: 120% 120% 100% 100%; } - + .penguin-top { top: 10%; left: 25%; @@ -94,7 +100,7 @@ tests: height: 45%; border-radius: 70% 70% 60% 60%; } - + .penguin-bottom { top: 40%; left: 23.5%; @@ -103,7 +109,7 @@ tests: height: 45%; border-radius: 70% 70% 100% 100%; } - + .right-hand { top: 5%; left: 25%; @@ -119,7 +125,7 @@ tests: transform-origin:0% 0%; animation-timing-function: linear; } - + @keyframes wave { 10% { transform: rotate(110deg); @@ -129,12 +135,12 @@ tests: } 30% { transform: rotate(110deg); - } + } 40% { transform: rotate(130deg); - } + } } - + .left-hand { top: 0%; left: 75%; @@ -145,7 +151,7 @@ tests: transform: rotate(-45deg); z-index: -1; } - + .right-feet { top: 85%; left: 60%; @@ -156,7 +162,7 @@ tests: transform: rotate(-80deg); z-index: -2222; } - + .left-feet { top: 85%; left: 25%; @@ -167,7 +173,7 @@ tests: transform: rotate(80deg); z-index: -2222; } - + .right-eye { top: 45%; left: 60%; @@ -176,7 +182,7 @@ tests: height: 17%; border-radius: 50%; } - + .left-eye { top: 45%; left: 25%; @@ -185,7 +191,7 @@ tests: height: 17%; border-radius: 50%; } - + .sparkle { top: 25%; left:-23%; @@ -194,7 +200,7 @@ tests: height: 100%; border-radius: 50%; } - + .blush-right { top: 65%; left: 15%; @@ -203,7 +209,7 @@ tests: height: 10%; border-radius: 50%; } - + .blush-left { top: 65%; left: 70%; @@ -212,7 +218,7 @@ tests: height: 10%; border-radius: 50%; } - + .beak-top { top: 60%; left: 40%; @@ -221,7 +227,7 @@ tests: height: 10%; border-radius: 50%; } - + .beak-bottom { top: 65%; left: 42%; @@ -230,11 +236,11 @@ tests: height: 10%; border-radius: 50%; } - + body { background:#c6faf1; } - + .penguin * { position: absolute; } @@ -262,7 +268,6 @@ tests:
- ``` @@ -274,7 +279,10 @@ tests: ## Solution
+ ```js // solution required ``` +
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-abbreviated-hex-code.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-abbreviated-hex-code.chinese.md index 62f358d74e..68c310c074 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-abbreviated-hex-code.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-abbreviated-hex-code.chinese.md @@ -2,37 +2,45 @@ id: bad87fee1348bd9aedf08719 title: Use Abbreviated Hex Code challengeType: 0 -videoUrl: '' -localeTitle: 使用缩写的十六进制代码 +videoUrl: 'https://scrimba.com/c/cRkpKAm' +forumTopicId: 18338 +localTitle: 使用缩写的十六进制编码 --- ## Description -
许多人对超过1600万种颜色的可能性感到不知所措。并且很难记住十六进制代码。幸运的是,你可以缩短它。例如,红色的十六进制代码#FF0000可以缩短为#F00 。这个缩短的形式给出一个红色数字,一个数字表示绿色,一个数字表示蓝色。这将可能的颜色总数减少到大约4,000。但浏览器会将#FF0000#F00解释为完全相同的颜色。
+
+许多人对超过 1600 万种颜色的可能性感到不知所措,并且很难记住十六进制编码。幸运的是,它也提供缩写的方法。 +例如,红色的#FF0000十六进制编码可以缩写成#F00。在这种缩写形式里,三个数字分别代表着红(R),绿(G),蓝(B)颜色。 +这样,颜色的可能性减少到了大约 4000 种。且在浏览器里#FF0000#F00完全是同一种颜色。 +
## Instructions -
继续,尝试使用缩写的十六进制代码为正确的元素着色。
颜色短十六进制代码
青色 #0FF
绿色 #0F0
#F00
紫红色 #F0F
+
+接下来,使用缩写的十六进制编码给元素设置正确的颜色。 +
ColorShort Hex Code
Cyan#0FF
Green#0F0
Red#F00
Fuchsia#F0F
+
## Tests
```yml tests: - - text: 给你的h1元素添加I am red!的文本I am red! color红色。 - testString: 'assert($(".red-text").css("color") === "rgb(255, 0, 0)", "Give your h1 element with the text I am red! the color red.");' - - text: '使用缩写hex code表示红色而不是十六进制代码#FF0000 。' - testString: 'assert(code.match(/\.red-text\s*?{\s*?color:\s*?#F00\s*?;\s*?}/gi), "Use the abbreviate hex code for the color red instead of the hex code #FF0000.");' - - text: 给你的h1元素添加I am green!的文本I am green! color绿色。 - testString: 'assert($(".green-text").css("color") === "rgb(0, 255, 0)", "Give your h1 element with the text I am green! the color green.");' - - text: '使用缩写的hex code表示绿色而不是十六进制代码#00FF00 。' - testString: 'assert(code.match(/\.green-text\s*?{\s*?color:\s*?#0F0\s*?;\s*?}/gi), "Use the abbreviated hex code for the color green instead of the hex code #00FF00.");' - - text: 给你的h1元素添加I am cyan!文字I am cyan!color青色。 - testString: 'assert($(".cyan-text").css("color") === "rgb(0, 255, 255)", "Give your h1 element with the text I am cyan! the color cyan.");' - - text: '使用缩写的hex code代替十六进制代码#00FFFF 。' - testString: 'assert(code.match(/\.cyan-text\s*?{\s*?color:\s*?#0FF\s*?;\s*?}/gi), "Use the abbreviated hex code for the color cyan instead of the hex code #00FFFF.");' - - text: 给你的h1元素文字I am fuchsia! color紫红色。 - testString: 'assert($(".fuchsia-text").css("color") === "rgb(255, 0, 255)", "Give your h1 element with the text I am fuchsia! the color fuchsia.");' - - text: '使用缩写的hex code作为颜色的紫红色而不是十六进制代码#FF00FF 。' - testString: 'assert(code.match(/\.fuchsia-text\s*?{\s*?color:\s*?#F0F\s*?;\s*?}/gi), "Use the abbreviated hex code for the color fuchsia instead of the hex code #FF00FF.");' + - text: '文本内容为I am red!h1元素的字体颜色应该为red。' + testString: assert($('.red-text').css('color') === 'rgb(255, 0, 0)', '文本内容为I am red!h1元素的字体颜色应该为red。'); + - text: '要使用缩写的red十六进制编码,而不是#FF0000。' + testString: 'assert(code.match(/\.red-text\s*?{\s*?color:\s*?#F00\s*?;\s*?}/gi), ''要使用缩写的red十六进制编码,而不是#FF0000。'');' + - text: '文本内容为I am green!h1元素的字体颜色应该为green。' + testString: assert($('.green-text').css('color') === 'rgb(0, 255, 0)', '文本内容为I am green!h1元素的字体颜色应该为green。'); + - text: '要使用缩写的green十六进制编码,而不是#00FF00的十六进制编码。' + testString: 'assert(code.match(/\.green-text\s*?{\s*?color:\s*?#0F0\s*?;\s*?}/gi), ''要使用缩写的green十六进制编码,而不是#00FF00。'');' + - text: '文本内容为I am cyan!h1元素的字体颜色应该为cyan。' + testString: assert($('.cyan-text').css('color') === 'rgb(0, 255, 255)', '文本内容为I am cyan!h1元素的字体颜色应该为cyan。'); + - text: '要使用缩写的cyan十六进制编码,而不是#00FFFF的十六进制编码。' + testString: 'assert(code.match(/\.cyan-text\s*?{\s*?color:\s*?#0FF\s*?;\s*?}/gi), ''要使用缩写的cyan十六进制编码,而不是#00FFFF。'');' + - text: '文本内容为I am fuchsia!h1元素的字体颜色应该为fuchsia。' + testString: assert($('.fuchsia-text').css('color') === 'rgb(255, 0, 255)', '文本内容为I am fuchsia!h1元素的字体颜色应该为fuchsia。'); + - text: '要使用缩写的fuchsia十六进制编码,而不是#FF00FF的十六进制编码。' + testString: 'assert(code.match(/\.fuchsia-text\s*?{\s*?color:\s*?#F0F\s*?;\s*?}/gi), ''要使用缩写的fuchsia十六进制编码,而不是#FF00FF。'');' ``` @@ -66,7 +74,6 @@ tests:

I am cyan!

I am green!

- ``` @@ -78,7 +85,9 @@ tests: ## Solution
-```js +```html // solution required ``` +
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-an-id-attribute-to-style-an-element.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-an-id-attribute-to-style-an-element.chinese.md index fb8ec90b9b..1f52aa74b3 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-an-id-attribute-to-style-an-element.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-an-id-attribute-to-style-an-element.chinese.md @@ -2,29 +2,44 @@ id: bad87dee1348bd9aede07836 title: Use an id Attribute to Style an Element challengeType: 0 -videoUrl: '' -localeTitle: 使用id属性为元素设置样式 +videoUrl: 'https://scrimba.com/c/cakyZfL' +forumTopicId: 18339 +localTitle: 使用 id 属性来设定元素的样式 --- ## Description -
关于id属性的一个很酷的事情是,像类一样,你可以使用CSS来设置它们的样式。但是, id不可重用,只应应用于一个元素。 id也具有比类更高的特异性(重要性),因此如果两者都应用于同一元素并且具有冲突的样式,则将应用id的样式。下面是一个示例,说明如何使用cat-photo-elementid属性获取cat-photo-element并为其指定绿色的背景颜色。在你的style元素中:
#cat-photo-element {
背景颜色:绿色;
}
请注意,在style元素中,您始终通过放置a来引用类.在他们的名字前面。你总是通过在他们的名字前放一个#来引用id。
+
+通过id属性,你可以做一些很酷的事情,例如,就像 class 一样,你可以使用 CSS 来设置他们的样式 +可是,id不可以重用,只应用于一个元素上。同时,在 CSS 里,id的优先级要高于class,如果一个元素同时应用了classid,并设置样式有冲突,会优先应用id的样式。 +选择idcat-photo-element的元素,并设置它的背景样式为green,可以在你的style标签里这样写: + +```css +#cat-photo-element { + background-color: green; +} +``` + +注意在style标签里,声明 class 的时候必须在名字前插入.符号。同样,在声明 id 的时候,也必须在名字前插入#符号。 +
## Instructions -
尝试提供您的表单,该表单现在具有cat-photo-formid属性,绿色背景。
+
+尝试给含有cat-photo-formid属性的form表单的背景颜色设置为green。 +
## Tests
```yml tests: - - text: 为form元素添加cat-photo-form的id。 - testString: 'assert($("form").attr("id") === "cat-photo-form", "Give your form element the id of cat-photo-form.");' - - text: 您的form元素应具有绿色的background-color 。 - testString: 'assert($("#cat-photo-form").css("background-color") === "rgb(0, 128, 0)", "Your form element should have the background-color of green.");' - - text: 确保您的form元素具有id属性。 - testString: 'assert(code.match(//gi) && code.match(//gi).length > 0, "Make sure your form element has an id attribute.");' - - text: 不要为form任何classstyle属性。 - testString: 'assert(!code.match(//gi) && !code.match(//gi), "Do not give your form any class or style attributes.");' + - text: '设置form元素的 id 为cat-photo-form。' + testString: assert($("form").attr("id") === "cat-photo-form", '设置form元素的 id 为cat-photo-form。'); + - text: '你的form元素应该含有background-colorcss 属性并且值为 green。' + testString: assert($("#cat-photo-form").css("background-color") === "rgb(0, 128, 0)", '你的form元素应该含有background-colorcss 属性并且值为 green。'); + - text: '确保你的form元素含有id属性。' + testString: assert(code.match(//gi) && code.match(//gi).length > 0, '确保你的form元素含有id属性。'); + - text: '不要在form元素上添加其他class属性或者style行内样式。' + testString: assert(!code.match(//gi) && !code.match(//gi), '不要在form元素上添加其他class属性或者style行内样式。'); ``` @@ -69,36 +84,34 @@ tests:

CatPhotoApp

-

Click here to view more cat photos.

- - A cute orange cat lying on its back. - + + 一只仰卧着的萌猫 +
-

Things cats love:

+

猫咪最喜欢的三件东西:

    -
  • cat nip
  • -
  • laser pointers
  • -
  • lasagna
  • +
  • 猫薄荷
  • +
  • 激光笔
  • +
  • 千层饼
-

Top 3 things cats hate:

+

猫咪最讨厌的三件东西:

    -
  1. flea treatment
  2. -
  3. thunder
  4. -
  5. other cats
  6. +
  7. 跳蚤
  8. +
  9. 打雷
  10. +
  11. 同类
- +
- -
- - -
- - + +
+ + +
+ +
- ``` @@ -110,7 +123,9 @@ tests: ## Solution
-```js +```html // solution required ``` +
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-attribute-selectors-to-style-elements.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-attribute-selectors-to-style-elements.chinese.md index 87aab1a806..019745f135 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-attribute-selectors-to-style-elements.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-attribute-selectors-to-style-elements.chinese.md @@ -2,27 +2,41 @@ id: 58c383d33e2e3259241f3076 title: Use Attribute Selectors to Style Elements challengeType: 0 -videoUrl: '' -localeTitle: 使用属性选择器来设置样式元素 +videoUrl: 'https://scrimba.com/c/cnpymfJ' +forumTopicId: 301092 +localTitle: 使用属性选择器来设置元素的样式 --- ## Description -
您已经为要特定样式的元素提供了idclass属性。这些被称为ID和类选择器。您可以使用其他CSS选择器来选择要设置样式的自定义元素组。让我们再次带出CatPhotoApp来练习使用CSS选择器。对于此挑战,您将使用[attr=value]属性选择器设置CatPhotoApp中复选框的样式。此选择器使用特定属性值匹配和设置元素样式。例如,下面的代码使用属性type和相应的radio值更改所有元素的边距:
[type ='radio'] {
保证金:20px 0px 20px 0px;
}
+
+你已经通过设置元素的idclass,来显示你想要的样式,而它们也被分别叫做 ID 选择器和 Class 选择器。另外,也还有其他的 CSS 选择器,可以让我们给特定的元素设置样式。 +让我们再次通过猫咪图片项目来练习 CSS 选择器。 +在这个挑战里,你会使用[attr=value]属性选择器修改复选框的样式。这个选择器使用特定的属性值来匹配和设置元素样式。例如,下面的代码会改变所有typeradio的元素的外边距。 + +```css +[type='radio'] { + margin: 20px 0px 20px 0px; +} +``` + +
## Instructions -
使用type属性选择器,尝试在CatPhotoApp中为复选框提供10px的上边距和15px的下边距。
+
+使用type属性选择器,尝试改变复选框的上外边距为 10px,下外边距为 15px。 +
## Tests
```yml tests: - - text: 应使用type属性选择器来选中复选框。 - testString: 'assert(code.match(/ +``` + +在style样式声明区域内,可以创建一个元素选择器,应用于所有的h2元素。例如,如果你想所有h2元素变成红色,可以添加下方的样式规则: + +```html + +``` + +注意,在每个元素的样式声明区域里,左右花括号({})一定要写全。你需要确保所有样式规则位于花括号之间,并且每条样式规则都以分号结束。 +
## Instructions -
删除h2元素的样式属性,而不是创建CSS style块。添加必要的CSS以将所有h2元素变为蓝色。
+
+删除h2元素的行内样式,然后创建style样式声明区域,最后添加 CSS 样式规则使h2元素变为蓝色。 +
## Tests
```yml tests: - - text: 从h2元素中删除style属性。 - testString: 'assert(!$("h2").attr("style"), "Remove the style attribute from your h2 element.");' - - text: 创建style元素。 - testString: 'assert($("style") && $("style").length > 1, "Create a style element.");' - - text: 你的h2元素应该是蓝色的。 - testString: 'assert($("h2").css("color") === "rgb(0, 0, 255)", "Your h2 element should be blue.");' - - text: 确保样式表h2声明对分号和右括号有效。 - testString: 'assert(code.match(/h2\s*\{\s*color\s*:.*;\s*\}/g), "Ensure that your stylesheet h2 declaration is valid with a semicolon and closing brace.");' - - text: 确保所有style元素都有效并具有结束标记。 - testString: 'assert(code.match(/<\/style>/g) && code.match(/<\/style>/g).length === (code.match(//g) || []).length, "Make sure all your style elements are valid and have a closing tag.");' + - text: '删除h2元素的行内样式。' + testString: assert(!$("h2").attr("style"), '删除h2元素的行内样式。'); + - text: '创建一个style样式声明区域。' + testString: assert($("style") && $("style").length >= 1, '创建一个style样式声明区域。'); + - text: 'h2元素颜色应为蓝色。' + testString: assert($("h2").css("color") === "rgb(0, 0, 255)", 'h2元素颜色应为蓝色。'); + - text: '确保h2选择器的内容被花括号所围绕,并且样式规则以分号结束。' + testString: 'assert(code.match(/h2\s*\{\s*color\s*:.*;\s*\}/g), ''确保h2选择器的内容被花括号所围绕,并且样式规则以分号结束。'');' ``` @@ -40,36 +63,35 @@ tests: ```html

CatPhotoApp

-

Click here to view more cat photos.

- - A cute orange cat lying on its back. - +

点击查看更多猫图.

+ + 一只仰卧着的萌猫 +
-

Things cats love:

+

猫咪最喜欢的三件东西:

    -
  • cat nip
  • -
  • laser pointers
  • -
  • lasagna
  • +
  • 猫薄荷
  • +
  • 激光笔
  • +
  • 千层饼
-

Top 3 things cats hate:

+

猫咪最讨厌的三件东西:

    -
  1. flea treatment
  2. -
  3. thunder
  4. -
  5. other cats
  6. +
  7. 跳蚤
  8. +
  9. 打雷
  10. +
  11. 同类
- +
- -
- - -
- - + +
+ + +
+ +
- ``` @@ -81,7 +103,8 @@ tests: ## Solution
-```js +```html // solution required ```
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-css-variables-to-change-several-elements-at-once.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-css-variables-to-change-several-elements-at-once.chinese.md index bedc6c2c40..ed6d565b0c 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-css-variables-to-change-several-elements-at-once.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-css-variables-to-change-several-elements-at-once.chinese.md @@ -2,27 +2,33 @@ id: 5a9d725e424fe3d0e10cad10 title: Use CSS Variables to change several elements at once challengeType: 0 -videoUrl: '' -localeTitle: 使用CSS变量一次更改多个元素 +videoUrl: 'https://scrimba.com/c/c6bDECm' +forumTopicId: 301093 +localTitle: 使用 CSS 变量一次更改多个元素 --- ## Description -
CSS变量是一种通过仅更改一个值来一次更改许多CSS样式属性的强大方法。按照以下说明查看如何仅更改三个值可以更改许多元素的样式。
+
+CSS 变量是一种仅更改一个值,来一次性更改多个 CSS 样式属性的强大方法。 +按照下面指示的来做,我们只需要改变三个值,多个样式将会同时被修改。 +
## Instructions -
penguin类中,将black值更改为gray ,将gray值更改为white ,将yellow值更改为orange
+
+在penguinclass 里,将black改为graygray改为whiteyellow改为orange。 +
## Tests
```yml tests: - - text: penguin类应声明--penguin-skin变量并将其指定为gray 。 - testString: 'assert(code.match(/.penguin\s*?{[\s\S]*--penguin-skin\s*?:\s*?gray\s*?;[\s\S]*}/gi), "penguin class should declare the --penguin-skin variable and assign it to gray.");' - - text: penguin类应声明--penguin-belly变量并将其指定为white 。 - testString: 'assert(code.match(/.penguin\s*?{[\s\S]*--penguin-belly\s*?:\s*?white\s*?;[\s\S]*}/gi), "penguin class should declare the --penguin-belly variable and assign it to white.");' - - text: penguin类应声明--penguin-beak变量并将其指定为orange 。 - testString: 'assert(code.match(/.penguin\s*?{[\s\S]*--penguin-beak\s*?:\s*?orange\s*?;[\s\S]*}/gi), "penguin class should declare the --penguin-beak variable and assign it to orange.");' + - text: 'penguin class 声明的--penguin-skin变量的值应为gray。' + testString: 'assert(code.match(/.penguin\s*?{[\s\S]*--penguin-skin\s*?:\s*?gray\s*?;[\s\S]*}/gi), ''penguin class 声明的--penguin-skin变量的值应为gray。'');' + - text: 'penguin class 声明的--penguin-belly变量的值应为white。' + testString: 'assert(code.match(/.penguin\s*?{[\s\S]*--penguin-belly\s*?:\s*?white\s*?;[\s\S]*}/gi), ''penguin class 声明的--penguin-belly变量的值应为white。'');' + - text: 'penguin class 声明的--penguin-beak变量的值应为orange。' + testString: 'assert(code.match(/.penguin\s*?{[\s\S]*--penguin-beak\s*?:\s*?orange\s*?;[\s\S]*}/gi), ''penguin class 声明的--penguin-beak变量的值应为orange。'');' ``` @@ -36,13 +42,13 @@ tests: ```html - ``` @@ -49,7 +62,8 @@ tests: ## Solution
-```js +```html // solution required ```
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-hex-code-to-mix-colors.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-hex-code-to-mix-colors.chinese.md index 58d040d612..4f59a6da71 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-hex-code-to-mix-colors.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-hex-code-to-mix-colors.chinese.md @@ -2,37 +2,47 @@ id: bad87fee1348bd9aedf08721 title: Use Hex Code to Mix Colors challengeType: 0 -videoUrl: '' -localeTitle: 使用十六进制代码混合颜色 +videoUrl: 'https://scrimba.com/c/cK89PhP' +forumTopicId: 18359 +localTitle: 使用十六进制编码混合颜色 --- ## Description -
要查看,十六进制代码使用6个十六进制数字来表示颜色,红色(R),绿色(G)和蓝色(B)组件各有两个。从这三种纯色(红色,绿色和蓝色),我们可以改变每种颜色的数量,创造超过1600万种其他颜色!例如,橙色是纯红色,混合了一些绿色,没有蓝色。在十六进制代码中,这转换为#FFA500 。数字0是十六进制代码中的最小数字,表示完全没有颜色。数字F是十六进制代码中的最大数字,表示最大可能的亮度。
+
+回顾一下,hex使用 6 个十六进制编码来表示颜色,2 个一组,分别代表着红(R),绿(G),蓝(B)。 +通过三原色,我们可以创建 1600 万种不同颜色! +例如,橘色是纯红色混合一些绿色而成的,没有蓝色的参与。在十六进制编码里面,它被转译为#FFA500。 +0是十六进制里面最小的数字,表示着没有颜色。 +F是十六进制里面最大的数字,表示着最高的亮度。 +
## Instructions -
style元素中的颜色词替换为正确的十六进制代码。
颜色 Hex代码
道奇蓝 #1E90FF
绿色 #00FF00
橙子 #FFA500
#FF0000
+
+把style标签里面的颜色值用正确的十六进制编码替换。 +
ColorHex Code
Dodger Blue#1E90FF
Green#00FF00
Orange#FFA500
Red#FF0000
+
## Tests
```yml tests: - - text: 给你的h1元素添加I am red!的文本I am red! color红色。 - testString: 'assert($(".red-text").css("color") === "rgb(255, 0, 0)", "Give your h1 element with the text I am red! the color red.");' - - text: 使用hex code为红色而不是red 。 - testString: 'assert(code.match(/\.red-text\s*?{\s*?color:\s*?#FF0000\s*?;\s*?}/gi), "Use the hex code for the color red instead of the word red.");' - - text: 给你的h1元素添加I am green!的文本I am green! color绿色。 - testString: 'assert($(".green-text").css("color") === "rgb(0, 255, 0)", "Give your h1 element with the text I am green! the color green.");' - - text: 使用hex code表示绿色而不是green 。 - testString: 'assert(code.match(/\.green-text\s*?{\s*?color:\s*?#00FF00\s*?;\s*?}/gi), "Use the hex code for the color green instead of the word green.");' - - text: 给你的h1元素提供I am dodger blue!的文字I am dodger blue! color道奇蓝色。 - testString: 'assert($(".dodger-blue-text").css("color") === "rgb(30, 144, 255)", "Give your h1 element with the text I am dodger blue! the color dodger blue.");' - - text: 使用颜色dodgerblue蓝色的hex code而不是单词dodgerblue 。 - testString: 'assert(code.match(/\.dodger-blue-text\s*?{\s*?color:\s*?#1E90FF\s*?;\s*?}/gi), "Use the hex code for the color dodger blue instead of the word dodgerblue.");' - - text: 给你的h1元素添加I am orange!的文本I am orange!color为橙色。 - testString: 'assert($(".orange-text").css("color") === "rgb(255, 165, 0)", "Give your h1 element with the text I am orange! the color orange.");' - - text: 使用hex code表示橙色而不是orange 。 - testString: 'assert(code.match(/\.orange-text\s*?{\s*?color:\s*?#FFA500\s*?;\s*?}/gi), "Use the hex code for the color orange instead of the word orange.");' + - text: '文本内容为I am red!h1元素的字体颜色应该为red。' + testString: assert($('.red-text').css('color') === 'rgb(255, 0, 0)', '文本内容为I am red!h1元素的字体颜色应该为red。'); + - text: '使用十六进制编码替换red关键词。' + testString: 'assert(code.match(/\.red-text\s*?{\s*?color:\s*?#FF0000\s*?;\s*?}/gi), ''使用十六进制编码替换red关键词。'');' + - text: '文本内容为I am green!h1元素的字体颜色应该为green。' + testString: assert($('.green-text').css('color') === 'rgb(0, 255, 0)', '文本内容为I am green!h1元素的字体颜色应该为green。'); + - text: '使用十六进制编码替换green关键词。' + testString: 'assert(code.match(/\.green-text\s*?{\s*?color:\s*?#00FF00\s*?;\s*?}/gi), ''使用十六进制编码替换green关键词。'');' + - text: '文本内容为I am dodger blue!h1元素的字体颜色应该为dodger blue。' + testString: assert($('.dodger-blue-text').css('color') === 'rgb(30, 144, 255)', '文本内容为I am dodger blue!h1元素的字体颜色应该为dodger blue。'); + - text: '使用十六进制编码替换dodgerblue关键词。' + testString: 'assert(code.match(/\.dodger-blue-text\s*?{\s*?color:\s*?#1E90FF\s*?;\s*?}/gi), ''使用十六进制编码替换dodgerblue关键词。'');' + - text: '文本内容为I am orange!h1元素的字体颜色应该为orange。' + testString: assert($('.orange-text').css('color') === 'rgb(255, 165, 0)', '文本内容为I am orange!h1元素的字体颜色应该为orange。'); + - text: '使用十六进制编码替换orange关键词。' + testString: 'assert(code.match(/\.orange-text\s*?{\s*?color:\s*?#FFA500\s*?;\s*?}/gi), ''使用十六进制编码替换orange关键词。'');' ``` @@ -66,7 +76,6 @@ tests:

I am dodger blue!

I am orange!

- ``` @@ -78,7 +87,9 @@ tests: ## Solution
-```js +```html // solution required ``` +
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-rgb-to-mix-colors.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-rgb-to-mix-colors.chinese.md index fe7068f5bb..cbf82696cc 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-rgb-to-mix-colors.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-rgb-to-mix-colors.chinese.md @@ -2,37 +2,43 @@ id: bad82fee1348bd9aedf08721 title: Use RGB to Mix Colors challengeType: 0 -videoUrl: '' -localeTitle: 使用RGB混合颜色 +videoUrl: 'https://scrimba.com/c/cm24JU6' +forumTopicId: 18368 +localTitle: 使用 RGB 混合颜色 --- ## Description -
就像使用十六进制代码一样,您可以使用不同值的组合来混合RGB中的颜色。
+
+就像使用十六进制编码一样,你可以通过不同值的组合,来混合得到不同的 RGB 颜色。 +
## Instructions -
style元素中的十六进制代码替换为正确的RGB值。
颜色 RGB
蓝色 rgb(0, 0, 255)
rgb(255, 0, 0)
兰花 rgb(218, 112, 214)
赭色 rgb(160, 82, 45)
+
+将style标签里面中的十六进制编码替换为正确的 RGB 值。 +
ColorRGB
Bluergb(0, 0, 255)
Redrgb(255, 0, 0)
Orchidrgb(218, 112, 214)
Siennargb(160, 82, 45)
+
## Tests
```yml tests: - - text: 给你的h1元素添加I am red!的文本I am red! color红色。 - testString: 'assert($(".red-text").css("color") === "rgb(255, 0, 0)", "Give your h1 element with the text I am red! the color red.");' - - text: 使用rgb表示红色。 - testString: 'assert(code.match(/\.red-text\s*?{\s*?color:\s*?rgb\(\s*?255\s*?,\s*?0\s*?,\s*?0\s*?\)\s*?;\s*?}/gi), "Use rgb for the color red.");' - - text: 给你的h1元素文字I am orchid!兰花的color 。 - testString: 'assert($(".orchid-text").css("color") === "rgb(218, 112, 214)", "Give your h1 element with the text I am orchid! the color orchid.");' - - text: 使用rgb作为颜色兰花。 - testString: 'assert(code.match(/\.orchid-text\s*?{\s*?color:\s*?rgb\(\s*?218\s*?,\s*?112\s*?,\s*?214\s*?\)\s*?;\s*?}/gi), "Use rgb for the color orchid.");' - - text: 给你的h1元素添加I am blue!的文本I am blue! color蓝色。 - testString: 'assert($(".blue-text").css("color") === "rgb(0, 0, 255)", "Give your h1 element with the text I am blue! the color blue.");' - - text: 使用rgb作为蓝色。 - testString: 'assert(code.match(/\.blue-text\s*?{\s*?color:\s*?rgb\(\s*?0\s*?,\s*?0\s*?,\s*?255\s*?\)\s*?;\s*?}/gi), "Use rgb for the color blue.");' - - text: 给你的h1元素添加I am sienna!的文本I am sienna! color sienna。 - testString: 'assert($(".sienna-text").css("color") === "rgb(160, 82, 45)", "Give your h1 element with the text I am sienna! the color sienna.");' - - text: 使用rgb作为颜色sienna。 - testString: 'assert(code.match(/\.sienna-text\s*?{\s*?color:\s*?rgb\(\s*?160\s*?,\s*?82\s*?,\s*?45\s*?\)\s*?;\s*?}/gi), "Use rgb for the color sienna.");' + - text: '文本内容为I am red!h1元素的字体颜色应该为red。' + testString: assert($('.red-text').css('color') === 'rgb(255, 0, 0)', '文本内容为I am red!h1元素的字体颜色应该为red。'); + - text: 'red颜色应使用RGB值。' + testString: 'assert(code.match(/\.red-text\s*?{\s*?color:\s*?rgb\(\s*?255\s*?,\s*?0\s*?,\s*?0\s*?\)\s*?;\s*?}/gi), ''red颜色应使用RGB值。'');' + - text: '文本内容为I am orchid!h1元素的字体颜色应该为orchid。' + testString: assert($('.orchid-text').css('color') === 'rgb(218, 112, 214)', '文本内容为I am orchid!h1元素的字体颜色应该为orchid。'); + - text: 'orchid颜色应使用RGB值。' + testString: 'assert(code.match(/\.orchid-text\s*?{\s*?color:\s*?rgb\(\s*?218\s*?,\s*?112\s*?,\s*?214\s*?\)\s*?;\s*?}/gi), ''red颜色应使用RGB值。'');' + - text: '文本内容为I am blue!h1元素的字体颜色应该为blue。' + testString: assert($('.blue-text').css('color') === 'rgb(0, 0, 255)', '文本内容为I am blue!h1元素的字体颜色应该为blue。'); + - text: 'blue颜色应使用RGB值。' + testString: 'assert(code.match(/\.blue-text\s*?{\s*?color:\s*?rgb\(\s*?0\s*?,\s*?0\s*?,\s*?255\s*?\)\s*?;\s*?}/gi), ''blue颜色应使用RGB值。'');' + - text: '文本内容为I am sienna!h1元素的字体颜色应该为sienna。' + testString: assert($('.sienna-text').css('color') === 'rgb(160, 82, 45)', '文本内容为I am sienna!h1元素的字体颜色应该为sienna。'); + - text: 'sienna颜色应使用RGB值。' + testString: 'assert(code.match(/\.sienna-text\s*?{\s*?color:\s*?rgb\(\s*?160\s*?,\s*?82\s*?,\s*?45\s*?\)\s*?;\s*?}/gi), ''sienna颜色应使用RGB值。'');' ``` @@ -66,7 +72,6 @@ tests:

I am sienna!

I am blue!

- ``` @@ -81,4 +86,6 @@ tests: ```js // solution required ``` +
+ \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-rgb-values-to-color-elements.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-rgb-values-to-color-elements.chinese.md index 58908552b0..461c3c0458 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-rgb-values-to-color-elements.chinese.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/use-rgb-values-to-color-elements.chinese.md @@ -2,25 +2,44 @@ id: bad87fee1348bd9aede08718 title: Use RGB values to Color Elements challengeType: 0 -videoUrl: '' -localeTitle: 将RGB值用于颜色元素 +videoUrl: 'https://scrimba.com/c/cRkp2fr' +forumTopicId: 18369 +localTitle: 使用 RGB 值为元素上色 --- ## Description -
另一种可以在CSS中表示颜色的方法是使用RGB值。黑色的RGB值如下所示: rgb(0, 0, 0)白色的RGB值如下所示: rgb(255, 255, 255)而不是像使用十六进制代码那样使用六个十六进制数字,使用RGB使用0到255之间的数字指定每种颜色的亮度。如果进行数学计算,一种颜色的两位数等于16乘以16,这总共得到256个值。因此,从零开始计数的RGB具有与十六进制代码完全相同的可能值。以下是使用RGB代码将身体背景更改为橙色的示例。
身体 {
background-color:rgb(255,165,0);
}
+
+另一种可以在 CSS 中表示颜色的方法是使用 RGB 值。 +黑色的 RGB 值声明如下: +rgb(0, 0, 0) +白色的 RGB 值声明如下: +rgb(255, 255, 255) +RGB 不像十六进制编码,并不需要用到 6 位十六进制数字。在 RGB 里,你只需要指定每种颜色的亮度大小,从 0 到 255。 +在数学的角度来看,如果将十六进制的一种颜色的两位数字相乘,16 乘以 16 也等于 256。所以,从 0 到 255 计算的 RGB 值的具有十六进制编码相同的颜色可能性。 +下面是通过使用 RGB 值设置背景颜色为橘色的例子: + +```css +body { + background-color: rgb(255, 165, 0); +} +``` + +
## Instructions -
让我们用黑色的RGB值替换body元素背景颜色中的十六进制代码: rgb(0, 0, 0)
+
+让我们用rgb(0, 0, 0)的 RGB 值替换body元素背景颜色的十六进制编码。 +
## Tests
```yml tests: - - text: 你的body元素应该有黑色背景。 - testString: 'assert($("body").css("background-color") === "rgb(0, 0, 0)", "Your body element should have a black background.");' - - text: 使用rgb为您的body元素提供黑色。 - testString: 'assert(code.match(/rgb\s*\(\s*0\s*,\s*0\s*,\s*0\s*\)/ig), "Use rgb to give your body element a color of black.");' + - text: 'body元素的背景颜色应该是黑色的。' + testString: assert($("body").css("background-color") === "rgb(0, 0, 0)", 'body元素的背景颜色应该是黑色的。'); + - text: 'body元素的背景颜色的黑色值应该为RGB值。' + testString: assert(code.match(/rgb\s*\(\s*0\s*,\s*0\s*,\s*0\s*\)/ig), 'body元素的背景颜色的黑色值应该为RGB值。'); ``` @@ -37,7 +56,6 @@ tests: background-color: #F00; } - ``` @@ -49,7 +67,9 @@ tests: ## Solution
-```js +```html // solution required ``` +
+ \ No newline at end of file