Skip to content

Commit 65cb6ea

Browse files
focus-kfchuluoyang
authored andcommitted
Translate basic-css (#17)
* add: 完成BasicCSS的前4个教程。 * alter: 修改调整翻译中文。 * add: 继续翻译3小节。 * fixed: 修复语义,以及翻译格式。 * update: 替换空格&修改css class翻译。 * remove extra whitespace
1 parent 0b410cf commit 65cb6ea

File tree

1 file changed

+62
-66
lines changed

1 file changed

+62
-66
lines changed

01-responsive-web-design/basic-css.json

Lines changed: 62 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,24 @@
88
"id": "bad87fee1348bd9aedf08803",
99
"title": "Change the Color of Text",
1010
"description": [
11-
"Now let's change the color of some of our text.",
12-
"We can do this by changing the <code>style</code> of your <code>h2</code> element.",
13-
"The property that is responsible for the color of an element's text is the <code>color</code> style property.",
14-
"Here's how you would set your <code>h2</code> element's text color to blue:",
11+
"现在来让我们修改一下文本的颜色。",
12+
"我们通过修改<code>h2</code>元素里面的 <code>style</code>",
13+
"<code>color</code>属性可以控制文本元素颜色。",
14+
"以下是改变<code>h2</code>元素为蓝色的方法:",
1515
"<code>&#60;h2 style=\"color: blue;\"&#62;CatPhotoApp&#60;/h2&#62;</code>",
16-
"Note that it is a good practice to end inline <code>style</code> declarations with a <code>;</code> .",
16+
"请注意行内<code>style</code>最好以<code>;</code>来结束。",
1717
"<hr>",
18-
"Change your <code>h2</code> element's style so that its text color is red."
18+
"请把<code>h2</code>元素的文本颜色设置为红色。"
1919
],
2020
"tests": [
2121
{
22-
"text": "Your <code>h2</code> element should be red.",
23-
"testString": "assert($(\"h2\").css(\"color\") === \"rgb(255, 0, 0)\", 'Your <code>h2</code> element should be red.');"
22+
"text": "你的<code>h2</code>元素应该为红色。",
23+
"testString": "assert($(\"h2\").css(\"color\") === \"rgb(255, 0, 0)\", '你的<code>h2</code>元素应该为红色。');"
2424
},
2525
{
26-
"text": "Your <code>style</code> declaration should end with a <code>;</code> .",
27-
"testString": "assert(code.match(/<h2\\s+style\\s*=\\s*(\\'|\")\\s*color\\s*:\\s*(?:rgb\\(\\s*255\\s*,\\s*0\\s*,\\s*0\\s*\\)|rgb\\(\\s*100%\\s*,\\s*0%\\s*,\\s*0%\\s*\\)|red|#ff0000|#f00|hsl\\(\\s*0\\s*,\\s*100%\\s*,\\s*50%\\s*\\))\\s*\\;(\\'|\")>\\s*CatPhotoApp\\s*<\\/h2>/),' Your <code>style</code> declaration should end with a <code>;</code> .');"
28-
}
26+
"text": "<code>h2</code>元素的<code>style</code> 属性的值应该以<code>;</code>结束。",
27+
"testString": "assert(code.match(/<h2\\s+style\\s*=\\s*(\\'|\")\\s*color\\s*:\\s*(?:rgb\\(\\s*255\\s*,\\s*0\\s*,\\s*0\\s*\\)|rgb\\(\\s*100%\\s*,\\s*0%\\s*,\\s*0%\\s*\\)|red|#ff0000|#f00|hsl\\(\\s*0\\s*,\\s*100%\\s*,\\s*50%\\s*\\))\\s*\\;(\\'|\")>\\s*CatPhotoApp\\s*<\\/h2>/),'<code>h2</code> 元素 <code>style</code> 属性的值应该以 <code>;</code> 结束。');"
28+
2929
],
3030
"challengeType": 0,
3131
"files": {
@@ -75,37 +75,33 @@
7575
"id": "bad87fee1348bd9aedf08805",
7676
"title": "Use CSS Selectors to Style Elements",
7777
"description": [
78-
"With CSS, there are hundreds of CSS <code>properties</code> that you can use to change the way an element looks on your page.",
79-
"When you entered <code>&#60;h2 style=\"color: red\"&#62;CatPhotoApp&#60;/h2&#62;</code>, you were styling that individual <code>h2</code> element with <code>inline CSS</code>, which stands for <code>Cascading Style Sheets</code>.",
80-
"That's one way to specify the style of an element, but there's a better way to apply <code>CSS</code>.",
81-
"At the top of your code, create a <code>style</code> block like this:",
78+
"在CSS中,有上百种<code>属性</code>可以让你改变页面样式。",
79+
"通过输入 <code>&#60;h2 style=\"color: red\"&#62;CatPhotoApp&#60;/h2&#62;</code><code>行内样式</code>,修改单一的<code>h2</code>元素的颜色的方式,配置 <code>层叠样式表(CSS)</code> 的方式之一。",
80+
"这是改变元素样式的一个特别方法,不过存在着更好的方法来设置<code>层叠样式表(CSS</code>",
81+
"在代码的顶部,创建一个 <code>style</code> 声明区域,如下方所示:",
8282
"<blockquote>&#60;style&#62;<br>&#60;/style&#62;</blockquote>",
83-
"Inside that style block, you can create a <code>CSS selector</code> for all <code>h2</code> elements. For example, if you wanted all <code>h2</code> elements to be red, you would add a style rule that looks like this:",
83+
"在style样式声明区域内,可以创建一个<code>CSS 选择器</code>的规则来应用于所有的<code>h2</code>元素。例如,如果你想所有<code>h2</code>元素变成红色,可以添加下方的样式规则:",
8484
"<blockquote>&#60;style&#62;<br>&nbsp;&nbsp;h2 {color: red;}<br>&#60;/style&#62;</blockquote>",
85-
"Note that it's important to have both opening and closing curly braces (<code>{</code> and <code>}</code>) around each element's style rule(s). You also need to make sure that your element's style definition is between the opening and closing style tags. Finally, be sure to add a semicolon to the end of each of your element's style rules.",
85+
"注意,在每个元素的样式声明区域里,左右花括号(<code>{</code> <code>}</code>)一定要写全。你需要确定你定义的样式规则位于花括号之间。以及,记得在每个元素样式规则的末尾添加分号。",
8686
"<hr>",
87-
"Delete your <code>h2</code> element's style attribute, and instead create a CSS <code>style</code> block. Add the necessary CSS to turn all <code>h2</code> elements blue."
87+
"删除<code>h2</code>元素的行内样式,创建<code>style</code>样式声明区域。添加CSS样式规则使<code>h2</code>元素变为蓝色。"
8888
],
8989
"tests": [
9090
{
91-
"text": "Remove the style attribute from your <code>h2</code> element.",
92-
"testString": "assert(!$(\"h2\").attr(\"style\"), 'Remove the style attribute from your <code>h2</code> element.');"
93-
},
94-
{
95-
"text": "Create a <code>style</code> element.",
96-
"testString": "assert($(\"style\") && $(\"style\").length > 1, 'Create a <code>style</code> element.');"
91+
"text": "移除<code>h2</code>元素的行内样式。",
92+
"testString": "assert(!$(\"h2\").attr(\"style\"), '移除<code>h2</code>元素的行内样式。');"
9793
},
9894
{
99-
"text": "Your <code>h2</code> element should be blue.",
100-
"testString": "assert($(\"h2\").css(\"color\") === \"rgb(0, 0, 255)\", 'Your <code>h2</code> element should be blue.');"
95+
"text": "创建一个<code>style</code>样式声明区域。",
96+
"testString": "assert($(\"style\") && $(\"style\").length > 1, '创建一个<code>style</code>样式声明区域。');"
10197
},
10298
{
103-
"text": "Ensure that your stylesheet <code>h2</code> declaration is valid with a semicolon and closing brace.",
104-
"testString": "assert(code.match(/h2\\s*\\{\\s*color\\s*:.*;\\s*\\}/g), 'Ensure that your stylesheet <code>h2</code> declaration is valid with a semicolon and closing brace.');"
99+
"text": "<code>h2</code>元素颜色应为蓝色。",
100+
"testString": "assert($(\"h2\").css(\"color\") === \"rgb(0, 0, 255)\", '<code>h2</code>元素颜色应为蓝色。');"
105101
},
106102
{
107-
"text": "Make sure all your <code>style</code> elements are valid and have a closing tag.",
108-
"testString": "assert(code.match(/<\\/style>/g) && code.match(/<\\/style>/g).length === (code.match(/<style((\\s)*((type|media|scoped|title|disabled)=\"[^\"]*\")?(\\s)*)*>/g) || []).length, 'Make sure all your <code>style</code> elements are valid and have a closing tag.');"
103+
"text": "确保你的样式声明里的<code>h2</code>规则需以花括号所包括,和分号结束。",
104+
"testString": "assert(code.match(/h2\\s*\\{\\s*color\\s*:.*;\\s*\\}/g), '确保你的样式声明里的<code>h2</code>规则需以花括号所包括,和分号结束。');"
109105
}
110106
],
111107
"challengeType": 0,
@@ -156,33 +152,33 @@
156152
"id": "bad87fee1348bd9aecf08806",
157153
"title": "Use a CSS Class to Style an Element",
158154
"description": [
159-
"Classes are reusable styles that can be added to HTML elements.",
160-
"Here's an example CSS class declaration:",
155+
"CSS 的<code>class</code>具有可重用性,可应用于各种 HTML 元素。",
156+
"一个 CSS<code>class</code>声明示例,如下所示:",
161157
"<blockquote>&#60;style&#62;<br>&nbsp;&nbsp;.blue-text {<br>&nbsp;&nbsp;&nbsp;&nbsp;color: blue;<br>&nbsp;&nbsp;}<br>&#60;/style&#62;</blockquote>",
162-
"You can see that we've created a CSS class called <code>blue-text</code> within the <code>&#60;style&#62;</code> tag.",
163-
"You can apply a class to an HTML element like this:",
158+
"可以看到,我们在<code>&#60;style&#62;</code>样式声明区域里,创建了一个名为<code>blue-text</code><code>class</code>选择器。",
159+
"你可以将 CSS<code>class</code>选择器应用到一个HTML元素里,如下所示:",
164160
"<code>&#60;h2 class=\"blue-text\"&#62;CatPhotoApp&#60;/h2&#62;</code>",
165-
"Note that in your CSS <code>style</code> element, class names start with a period. In your HTML elements' class attribute, the class name does not include the period.",
161+
"注意你的<code>style</code>样式区域声明里,<code>class</code>需以句号开头。而在你的HTML元素里的<code>class</code>属性的类名,不需要包含句号",
166162
"<hr>",
167-
"Inside your <code>style</code> element, change the <code>h2</code> selector to <code>.red-text</code> and update the color's value from <code>blue</code> to <code>red</code>.",
168-
"Give your <code>h2</code> element the <code>class</code> attribute with a value of <code>'red-text'</code>."
163+
"<code>style</code>样式声明里,<code>h2</code>元素选择器改为<code>.red-text</code>的 CSS <code>class</code> 择器,同时将颜色<code>blue</code>变为<code>red</code>",
164+
"在你的<code>h2</code>元素里,添加一个<code>class</code>属性,且值为<code>'red-text'</code>"
169165
],
170166
"tests": [
171167
{
172-
"text": "Your <code>h2</code> element should be red.",
173-
"testString": "assert($(\"h2\").css(\"color\") === \"rgb(255, 0, 0)\", 'Your <code>h2</code> element should be red.');"
168+
"text": "你的<code>h2</code>元素应该为红色。",
169+
"testString": "assert($(\"h2\").css(\"color\") === \"rgb(255, 0, 0)\", '你的<code>h2</code>元素应该为红色。');"
174170
},
175171
{
176-
"text": "Your <code>h2</code> element should have the class <code>red-text</code>.",
177-
"testString": "assert($(\"h2\").hasClass(\"red-text\"), 'Your <code>h2</code> element should have the class <code>red-text</code>.');"
172+
"text": "你的<code>h2</code>元素应含有<code>red-text</code> class 选择器。",
173+
"testString": "assert($(\"h2\").hasClass(\"red-text\"), '你的<code>h2</code>元素应含有<code>red-text</code> class 选择器。');"
178174
},
179175
{
180-
"text": "Your stylesheet should declare a <code>red-text</code> class and have its color set to red.",
181-
"testString": "assert(code.match(/\\.red-text\\s*\\{\\s*color\\s*:\\s*red;\\s*\\}/g), 'Your stylesheet should declare a <code>red-text</code> class and have its color set to red.');"
176+
"text": "你的<code>style</code>样式声明区域里应该包含一个<code>red-text</code> class 选择器,并且它的颜色应为红色。",
177+
"testString": "assert(code.match(/\\.red-text\\s*\\{\\s*color\\s*:\\s*red;\\s*\\}/g), '你的<code>style</code>样式声明区域里应该包含一个<code>red-text</code> class 选择器,并且它的颜色应为红色。');"
182178
},
183179
{
184-
"text": "Do not use inline style declarations like <code>style=\"color&#58; red\"</code> in your <code>h2</code> element.",
185-
"testString": "assert($(\"h2\").attr(\"style\") === undefined, 'Do not use inline style declarations like <code>style=\"color&#58; red\"</code> in your <code>h2</code> element.');"
180+
"text": "不要在<code>h2</code>元素里使用<code>style=\"color&#58; red\"</code>的行内样式 。",
181+
"testString": "assert($(\"h2\").attr(\"style\") === undefined, '不要在<code>h2</code>元素里使用<code>style=\"color&#58; red\"</code>的行内样式 。');"
186182
}
187183
],
188184
"challengeType": 0,
@@ -239,28 +235,28 @@
239235
"id": "bad87fee1348bd9aefe08806",
240236
"title": "Style Multiple Elements with a CSS Class",
241237
"description": [
242-
"Classes allow you to use the same CSS styles on multiple HTML elements. You can see this by applying your <code>red-text</code> class to the first <code>p</code> element."
238+
"通过 CSS class 选择器,多个 HTML 元素可以使用相同的 CSS 样式规则。你可以将<code>red-text</code> class 选择器应用在第一个<code>p</code>元素上。"
243239
],
244240
"tests": [
245241
{
246-
"text": "Your <code>h2</code> element should be red.",
247-
"testString": "assert($(\"h2\").css(\"color\") === \"rgb(255, 0, 0)\", 'Your <code>h2</code> element should be red.');"
242+
"text": "你的<code>h2</code>元素应该是红色的。",
243+
"testString": "assert($(\"h2\").css(\"color\") === \"rgb(255, 0, 0)\", '你的<code>h2</code>元素应该是红色的。');"
248244
},
249245
{
250-
"text": "Your <code>h2</code> element should have the class <code>red-text</code>.",
251-
"testString": "assert($(\"h2\").hasClass(\"red-text\"), 'Your <code>h2</code> element should have the class <code>red-text</code>.');"
246+
"text": "你的<code>h2</code>元素应该含有名为<code>red-text</code> 的 class 选择器。",
247+
"testString": "assert($(\"h2\").hasClass(\"red-text\"), '你的<code>h2</code>元素应该含有名为<code>red-text</code> 的 class 选择器。');"
252248
},
253249
{
254-
"text": "Your first <code>p</code> element should be red.",
255-
"testString": "assert($(\"p:eq(0)\").css(\"color\") === \"rgb(255, 0, 0)\", 'Your first <code>p</code> element should be red.');"
250+
"text": "你的第一个<code>p</code>元素应该为红色。",
251+
"testString": "assert($(\"p:eq(0)\").css(\"color\") === \"rgb(255, 0, 0)\", '你的第一个<code>p</code>元素应该为红色。');"
256252
},
257253
{
258-
"text": "Your second and third <code>p</code> elements should not be red.",
259-
"testString": "assert(!($(\"p:eq(1)\").css(\"color\") === \"rgb(255, 0, 0)\") && !($(\"p:eq(2)\").css(\"color\") === \"rgb(255, 0, 0)\"), 'Your second and third <code>p</code> elements should not be red.');"
254+
"text": "你的第二和第三个<code>p</code>元素不应该为红色。",
255+
"testString": "assert(!($(\"p:eq(1)\").css(\"color\") === \"rgb(255, 0, 0)\") && !($(\"p:eq(2)\").css(\"color\") === \"rgb(255, 0, 0)\"), '你的第二和第三个<code>p</code>元素不应该为红色。');"
260256
},
261257
{
262-
"text": "Your first <code>p</code> element should have the class <code>red-text</code>.",
263-
"testString": "assert($(\"p:eq(0)\").hasClass(\"red-text\"), 'Your first <code>p</code> element should have the class <code>red-text</code>.');"
258+
"text": "你的第一个<code>p</code>元素应该包含名为<code>red-text</code>的 class 选择器。",
259+
"testString": "assert($(\"p:eq(0)\").hasClass(\"red-text\"), '你的第一个<code>p</code> 元素应该包含名为<code>red-text</code>的 class 选择器。');"
264260
}
265261
],
266262
"challengeType": 0,
@@ -317,15 +313,15 @@
317313
"id": "bad87fee1348bd9aedf08806",
318314
"title": "Change the Font Size of an Element",
319315
"description": [
320-
"Font size is controlled by the <code>font-size</code> CSS property, like this:",
316+
"字体大小由<code>font-size</code> CSS 属性控制,如下所示:",
321317
"<blockquote>h1 {<br>&nbsp;&nbsp;font-size: 30px;<br>}</blockquote>",
322318
"<hr>",
323-
"Inside the same <code>&#60;style&#62;</code> tag that contains your <code>red-text</code> class, create an entry for <code>p</code> elements and set the <code>font-size</code> to 16 pixels (<code>16px</code>)."
319+
"在包含<code>red-text</code> class 的<code>&#60;style&#62;</code>声明区域的里,创建一个<code>p</code>元素样式规则,并设置<code>font-size</code>16 像素(<code>16px</code>)"
324320
],
325321
"tests": [
326322
{
327-
"text": "Between the <code>style</code> tags, give the <code>p</code> elements <code>font-size</code> of <code>16px</code>. Browser and Text zoom should be at 100%.",
328-
"testString": "assert(code.match(/p\\s*{\\s*font-size\\s*:\\s*16\\s*px\\s*;\\s*}/i), 'Between the <code>style</code> tags, give the <code>p</code> elements <code>font-size</code> of <code>16px</code>. Browser and Text zoom should be at 100%.');"
323+
"text": "<code>style</code>样式声明区域里,<code>p</code>元素的<code>font-size</code>的值应为<code>16px</code>,浏览器和文本缩放应设置为 100%。",
324+
"testString": "assert(code.match(/p\\s*{\\s*font-size\\s*:\\s*16\\s*px\\s*;\\s*}/i), '<code>style</code>样式声明区域里,<code>p</code>元素的<code>font-size</code>的值应为<code>16px</code>,浏览器和文本缩放应设置为 100%。');"
329325
}
330326
],
331327
"challengeType": 0,
@@ -382,16 +378,16 @@
382378
"id": "bad87fee1348bd9aede08807",
383379
"title": "Set the Font Family of an Element",
384380
"description": [
385-
"You can set which font an element should use, by using the <code>font-family</code> property.",
386-
"For example, if you wanted to set your <code>h2</code> element's font to <code>sans-serif</code>, you would use the following CSS:",
381+
"通过<code>font-family</code>属性,可以设置元素里面的字体样式。",
382+
"例如,如果你想设置<code>h2</code>元素的字体为<code>sans-serif</code>,你可以用以下的 CSS 规则:",
387383
"<blockquote>h2 {<br>&nbsp;&nbsp;font-family: sans-serif;<br>}</blockquote>",
388384
"<hr>",
389-
"Make all of your <code>p</code> elements use the <code>monospace</code> font."
385+
"确保你所有的<code>p</code>元素使用<code>monospace</code>字体。"
390386
],
391387
"tests": [
392388
{
393-
"text": "Your <code>p</code> elements should use the font <code>monospace</code>.",
394-
"testString": "assert($(\"p\").not(\".red-text\").css(\"font-family\").match(/monospace/i), 'Your <code>p</code> elements should use the font <code>monospace</code>.');"
389+
"text": "你的<code>p</code>元素应该使用<code>monospace</code>字体。",
390+
"testString": "assert($(\"p\").not(\".red-text\").css(\"font-family\").match(/monospace/i), '你的<code>p</code>元素应该使用<code>monospace</code>字体。');"
395391
}
396392
],
397393
"challengeType": 0,
@@ -4399,4 +4395,4 @@
43994395
}
44004396
}
44014397
]
4402-
}
4398+
}

0 commit comments

Comments
 (0)