div 元素都有一个闭合标签。');"
}
],
"challengeType": 0,
@@ -1187,31 +1187,31 @@
}
],
"description": [
- "Font Awesome is a convenient library of icons. These icons are vector graphics, stored in the
.svg file format. These icons are treated just like fonts. You can specify their size using pixels, and they will assume the font size of their parent HTML elements.",
- "You can include Font Awesome in any app by adding the following code to the top of your HTML:",
+ "Font Awesome 是一个非常便利的图标库。这些图标都是被保存在
.svg 的文件格式中的矢量图。这些图标就和字体一样,不仅能通过像素单位指定他们的大小,它们也同样会继承父级 HTML 元素的字体大小。",
+ "你可以将 Font Awesome 图标库添加至任何一个 app 中,方法很简单,只需要在你的 HTML 头部增加下列代码即可:",
"
<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css\" integrity=\"sha384-XdYbMnZ/QjLh6iI4ogqCTaIjrFk87ip+ekIjefZch0Y+PvJ8CDYtEs1ipDmPorQ+\" crossorigin=\"anonymous\">",
- "In this case, we've already added it for you to this page behind the scenes.",
- "The
i element was originally used to make other elements italic, but is now commonly used for icons. You can add the Font Awesome classes to the
i element to turn it into an icon, for example:",
+ "不过在这里,我们已经预先为此页面添加了上述代码。",
+ "
i 元素起初用于让其它元素具有斜体(italic)的效果,不过现在一般用于指代图标。你可以把 Font Awesome 中的 class 属性添加到 i 元素中,让它变成一个图标,比如:",
"
<i class=\"fa fa-info-circle\"></i>",
- "Note that the
span element is also acceptable for use with icons.",
- "Use Font Awesome to add a
thumbs-up icon to your like button by giving it an
i element with the classes
fa and
fa-thumbs-up; make sure to keep the text \"Like\" next to the icon."
+ "记住
span 元素也一样可以用于指代图标。",
+ "你可以通过 Font Awesome 库增加一个
thumbs-up 图标到你的 like 按钮上,具体方法是给 i 元素添加 class 属性
fa 和
fa-thumbs-up;确保你的 \"Like\" 文本在图标旁边。"
],
"tests": [
{
- "text": "Add an
i element with the classes
fa and
fa-thumbs-up.",
- "testString": "assert($(\"i\").is(\".fa.fa-thumbs-up\") || $(\"span\").is(\".fa.fa-thumbs-up\"), 'Add an
i element with the classes
fa and
fa-thumbs-up.');"
+ "text": "增加一个 class 为
fa 和
fa-thumbs-up 的
i 元素。",
+ "testString": "assert($(\"i\").is(\".fa.fa-thumbs-up\") || $(\"span\").is(\".fa.fa-thumbs-up\"), '增加一个包含
fa 和
fa-thumbs-up class 的
i 元素。');"
},
{
- "text": "Your
fa-thumbs-up icon should be located within the Like button.",
- "testString": "assert(($(\"i.fa-thumbs-up\").parent().text().match(/Like/gi) && $(\".btn-primary > i\").is(\".fa.fa-thumbs-up\")) || ($(\"span.fa-thumbs-up\").parent().text().match(/Like/gi) && $(\".btn-primary > span\").is(\".fa.fa-thumbs-up\")), 'Your
fa-thumbs-up icon should be located within the Like button.');"
+ "text": "
fa-thumbs-up 图标应该放在 Like 按钮中。",
+ "testString": "assert(($(\"i.fa-thumbs-up\").parent().text().match(/Like/gi) && $(\".btn-primary > i\").is(\".fa.fa-thumbs-up\")) || ($(\"span.fa-thumbs-up\").parent().text().match(/Like/gi) && $(\".btn-primary > span\").is(\".fa.fa-thumbs-up\")), '
fa-thumbs-up 图标应该放在 Like 按钮中。');"
},
{
- "text": "Nest your
i element within your
button element.",
- "testString": "assert($(\"button\").children(\"i\").length > 0 || $(\"button\").children(\"span\").length > 0, 'Nest your
i element within your
button element.');"
+ "text": "将
i 元素放置在你的
button 元素中。",
+ "testString": "assert($(\"button\").children(\"i\").length > 0 || $(\"button\").children(\"span\").length > 0, '将
i 元素放置在你的
button 元素中。');"
},
{
- "text": "Make sure your icon element has a closing tag.",
- "testString": "assert(code.match(/<\\/i>|<\\/span>/g), 'Make sure your icon element has a closing tag.');"
+ "text": "确保你的图标元素有一个闭合标签。",
+ "testString": "assert(code.match(/<\\/i>|<\\/span>/g), '确保你的图标元素有一个闭合标签。');"
}
],
"challengeType": 0,
@@ -1294,22 +1294,22 @@
}
],
"description": [
- "Font Awesome is a convenient library of icons. These icons are vector graphics, stored in the
.svg file format. These icons are treated just like fonts. You can specify their size using pixels, and they will assume the font size of their parent HTML elements.",
- "Use Font Awesome to add an
info-circle icon to your info button and a
trash icon to your delete button.",
- "Note: The
span element is an acceptable alternative to the
i element for the directions below."
+ "Font Awesome 是一个非常便利的图标库。这些图标都是被保存在
.svg 的文件格式中的矢量图。这些图标就和字体一样,不仅能通过像素单位指定他们的大小,它们也同样会继承父级 HTML 元素的字体大小。",
+ "使用 Font Awesome 分别为你的 info 按钮添加
info-circle 图标,为你的 delete 按钮添加
trash 图标。",
+ "记住:下述要求中的
i 元素可以用
span 元素代替。"
],
"tests": [
{
- "text": "You should add a
<i class=\"fa fa-info-circle\"></i> within your info button element.",
- "testString": "assert($(\".btn-info > i\").is(\".fa.fa-info-circle\") || $(\".btn-info > span\").is(\".fa.fa-info-circle\"), 'You should add a
<i class=\"fa fa-info-circle\"></i> within your info button element.');"
+ "text": "添加一个
<i class=\"fa fa-info-circle\"></i> 图标到你的 info 按钮元素中。",
+ "testString": "assert($(\".btn-info > i\").is(\".fa.fa-info-circle\") || $(\".btn-info > span\").is(\".fa.fa-info-circle\"), '添加一个
<i class=\"fa fa-info-circle\"></i> 到你的 info 按钮元素中。');"
},
{
- "text": "You should add a
<i class=\"fa fa-trash\"></i> within your delete button element.",
- "testString": "assert($(\".btn-danger > i\").is(\".fa.fa-trash\") || $(\".btn-danger > span\").is(\".fa.fa-trash\"), 'You should add a
<i class=\"fa fa-trash\"></i> within your delete button element.');"
+ "text": "添加一个
<i class=\"fa fa-trash\"></i> 图标到你的 delete 按钮元素中。",
+ "testString": "assert($(\".btn-danger > i\").is(\".fa.fa-trash\") || $(\".btn-danger > span\").is(\".fa.fa-trash\"), '添加一个
<i class=\"fa fa-trash\"></i> 图标到你的 delete 按钮元素中。');"
},
{
- "text": "Make sure each of your
i elements has a closing tag and
<i class=\"fa fa-thumbs-up\"></i> is in your like button element.",
- "testString": "assert(code.match(/<\\/i>|<\\/span/g) && code.match(/<\\/i|<\\/span>/g).length > 2 && ($(\".btn-primary > i\").is(\".fa.fa-thumbs-up\") || $(\".btn-primary > span\").is(\".fa.fa-thumbs-up\")), 'Make sure each of your
i elements has a closing tag and
<i class=\"fa fa-thumbs-up\"></i> is in your like button element.');"
+ "text": "确保每一个
i 元素都有一个闭合标签并且
<i class=\"fa fa-thumbs-up\"></i> 在 like 按钮元素中。",
+ "testString": "assert(code.match(/<\\/i>|<\\/span/g) && code.match(/<\\/i|<\\/span>/g).length > 2 && ($(\".btn-primary > i\").is(\".fa.fa-thumbs-up\") || $(\".btn-primary > span\").is(\".fa.fa-thumbs-up\")), '确保每一个
i 元素都有一个闭合标签并且
<i class=\"fa fa-thumbs-up\"></i> 在 like 按钮元素中。');"
}
],
"challengeType": 0,
@@ -1392,22 +1392,22 @@
}
],
"description": [
- "You can use Bootstrap's
col-xs-* classes on
form elements, too! This way, our radio buttons will be evenly spread out across the page, regardless of how wide the screen resolution is.",
- "Nest both your radio buttons within a
<div class=\"row\"> element. Then nest each of them within a
<div class=\"col-xs-6\"> element.",
- "
Note: As a reminder, radio buttons are
input elements of type
radio."
+ "你还可以将 Bootstrap 的
col-xs-* class 用在
form 元素上!这样我们就可以在不关心屏幕大小的情况下,将我们的单选按钮均匀的放在页面上。",
+ "将你的所有单选按钮放入
<div class=\"row\"> 元素。再用
<div class=\"col-xs-6\"> 元素包裹每一个单选按钮。",
+ "
记住: 提醒一句,单选按钮是 type 为
radio 的
input 元素。"
],
"tests": [
{
- "text": "Nest all of your radio buttons inside one
div with the class
row.",
- "testString": "assert($(\"div.row:has(input[type=\\\"radio\\\"])\").length > 0, 'Nest all of your radio buttons inside one
div with the class
row.');"
+ "text": "把你所有的单选按钮放置于具有
row class 的
div 元素中。",
+ "testString": "assert($(\"div.row:has(input[type=\\\"radio\\\"])\").length > 0, '把你所有的单选按钮放置于具有
row class 的
div 元素中。');"
},
{
- "text": "Nest each of your radio buttons inside its own
div with the class
col-xs-6.",
- "testString": "assert($(\"div.col-xs-6:has(input[type=\\\"radio\\\"])\").length > 1, 'Nest each of your radio buttons inside its own
div with the class
col-xs-6.');"
+ "text": "你的每一个单选按钮应该嵌套于自己的
div 元素中,每个
div 元素都具有
col-xs-6 class。",
+ "testString": "assert($(\"div.col-xs-6:has(input[type=\\\"radio\\\"])\").length > 1, '你的每一个单选按钮应该嵌套于自己的
div 元素中,每个
div 元素都具有
col-xs-6 class。');"
},
{
- "text": "Make sure each of your
div elements has a closing tag.",
- "testString": "assert(code.match(/<\\/div>/g) && code.match(/
/g).length === code.match(/
div elements has a closing tag.');"
+ "text": "确保你所有
div 元素都有一个闭合标签。",
+ "testString": "assert(code.match(/<\\/div>/g) && code.match(/
/g).length === code.match(/
div 元素都有一个闭合标签。');"
}
],
"challengeType": 0,
@@ -1490,21 +1490,21 @@
}
],
"description": [
- "You can use Bootstrap's
col-xs-* classes on
form elements, too! This way, our checkboxes will be evenly spread out across the page, regardless of how wide the screen resolution is.",
- "Nest all three of your checkboxes in a
<div class=\"row\"> element. Then nest each of them in a
<div class=\"col-xs-4\"> element."
+ "你还可以将 Bootstrap 的
col-xs-* 用在
form 元素上!这样我们就可以在不关心屏幕大小的情况下,将我们的复选框均匀的放在页面上了。",
+ "将你的所有复选框都放置于一个
<div class=\"row\"> 元素中。然后分别把每个复选框都放置于一个
<div class=\"col-xs-4\"> 元素中。"
],
"tests": [
{
- "text": "Nest all of your checkboxes inside one
div with the class
row.",
- "testString": "assert($(\"div.row:has(input[type=\\\"checkbox\\\"])\").length > 0, 'Nest all of your checkboxes inside one
div with the class
row.');"
+ "text": "将你所有的复选框嵌入一个含有
row class 的
div 元素中。",
+ "testString": "assert($(\"div.row:has(input[type=\\\"checkbox\\\"])\").length > 0, '将你所有的复选框嵌入一个含有
row class 的
div 元素中。');"
},
{
- "text": "Nest each of your checkboxes inside its own
div with the class
col-xs-4.",
- "testString": "assert($(\"div.col-xs-4:has(input[type=\\\"checkbox\\\"])\").length > 2, 'Nest each of your checkboxes inside its own
div with the class
col-xs-4.');"
+ "text": "你的每一个复选框应该嵌套于自己的
div 元素中,每个
div 元素都具有
col-xs-4 class。",
+ "testString": "assert($(\"div.col-xs-4:has(input[type=\\\"checkbox\\\"])\").length > 2, '你的每一个复选框应该嵌套于自己的
div 元素中,每个
div 元素都具有
col-xs-4 class。');"
},
{
- "text": "Make sure each of your
div elements has a closing tag.",
- "testString": "assert(code.match(/<\\/div>/g) && code.match(/
/g).length === code.match(/
div elements has a closing tag.');"
+ "text": "确保你所有
div 元素都有一个闭合标签。",
+ "testString": "assert(code.match(/<\\/div>/g) && code.match(/
/g).length === code.match(/
div 元素都有一个闭合标签。');"
}
],
"challengeType": 0,
@@ -1594,26 +1594,27 @@
}
],
"description": [
- "You can add the
fa-paper-plane Font Awesome icon by adding
<i class=\"fa fa-paper-plane\"></i> within your submit
button element.",
- "Give your form's text input field a class of
form-control. Give your form's submit button the classes
btn btn-primary. Also give this button the Font Awesome icon of
fa-paper-plane.",
- "All textual
<input>,
<textarea>, and
<select> elements with the class
.form-control have a width of 100%."
+ "你可以在你的 submit
button 按钮里面加上
<i class=\"fa fa-paper-plane\"></i> 来添加 Font Awesome 的
fa-paper-plane 图标。",
+ "为表单的文本输入框(text input)添加一个
form-control class。为表单的提交(submit)按钮添加一个
btn btn-primary class,并为它加上 Font Awesome 的
fa-paper-plane 图标。",
+ "All textual
<input>,
<textarea>, and
<select> elements with the class
.form-control have a width of 100%.",
+ "所有文本输入类的元素如
<input>,
<textarea> 和
<select> 只要添加上
.form-control class 就会占满100%的宽度。"
],
"tests": [
{
- "text": "Give the submit button in your form the classes
btn btn-primary.",
- "testString": "assert($(\"button[type=\\\"submit\\\"]\").hasClass(\"btn btn-primary\"), 'Give the submit button in your form the classes
btn btn-primary.');"
+ "text": "给你的 submit 按钮添加
btn btn-primary class。",
+ "testString": "assert($(\"button[type=\\\"submit\\\"]\").hasClass(\"btn btn-primary\"), '给你的 submit 按钮添加
btn btn-primary class。');"
},
{
- "text": "Add a
<i class=\"fa fa-paper-plane\"></i> within your submit
button element.",
- "testString": "assert($(\"button[type=\\\"submit\\\"]:has(i.fa.fa-paper-plane)\").length > 0, 'Add a
<i class=\"fa fa-paper-plane\"></i> within your submit
button element.');"
+ "text": "在你的 submit
button 元素嵌入
<i class=\"fa fa-paper-plane\"></i>。",
+ "testString": "assert($(\"button[type=\\\"submit\\\"]:has(i.fa.fa-paper-plane)\").length > 0, '在你的 submit
button 元素嵌入
<i class=\"fa fa-paper-plane\"></i>。');"
},
{
- "text": "Give the text
input in your form the class
form-control.",
- "testString": "assert($(\"input[type=\\\"text\\\"]\").hasClass(\"form-control\"), 'Give the text
input in your form the class
form-control.');"
+ "text": "给表单中的 text
input 元素添加
form-control class。",
+ "testString": "assert($(\"input[type=\\\"text\\\"]\").hasClass(\"form-control\"), '给表单中的 text
input 元素添加
form-control class。');"
},
{
- "text": "Make sure each of your
i elements has a closing tag.",
- "testString": "assert(code.match(/<\\/i>/g) && code.match(/<\\/i/g).length > 3, 'Make sure each of your
i elements has a closing tag.');"
+ "text": "确保每一个
i 元素都有一个闭合标签。",
+ "testString": "assert(code.match(/<\\/i>/g) && code.match(/<\\/i/g).length > 3, '确保每一个
i 元素都有一个闭合标签。');"
}
],
"challengeType": 0,
@@ -1711,26 +1712,26 @@
}
],
"description": [
- "Now let's get your form
input and your submission
button on the same line. We'll do this the same way we have previously: by using a
div element with the class
row, and other
div elements within it using the
col-xs-* class.",
- "Nest both your form's text
input and submit
button within a
div with the class
row. Nest your form's text
input within a div with the class of
col-xs-7. Nest your form's submit
button in a
div with the class
col-xs-5.",
- "This is the last challenge we'll do for our Cat Photo App for now. We hope you've enjoyed learning Font Awesome, Bootstrap, and responsive design!"
+ "现在让我们把你表单里的
input 元素和 submit
button (提交按钮)放在同一行。跟着之前的做法来就行:准备好一个具有
row class 的
div 元素还有几个具有
col-xs-* class 的
div 元素。",
+ "先把你表单的 text
input (文本输入框)和 submit
button (提交按钮)放进具有
row class 的
div 中。再用
col-xs-7 class 的 div 包裹表单的 text
input (文本输入框),
col-xs-5 class 的 div 包裹表单的 submit
button (提交按钮)。",
+ "这是我们到目前为止 Cat Photo App 的最后一个挑战了。我希望你能喜欢 Font Awesome, Bootstrap,和响应式设计!"
],
"tests": [
{
- "text": "Nest your form submission button and text input in a div with class
row.",
- "testString": "assert($(\"div.row:has(input[type=\\\"text\\\"])\").length > 0 && $(\"div.row:has(button[type=\\\"submit\\\"])\").length > 0, 'Nest your form submission button and text input in a div with class
row.');"
+ "text": "确保你的提交按钮和文本输入框都在同一个具有
row class 的 div 元素中。",
+ "testString": "assert($(\"div.row:has(input[type=\\\"text\\\"])\").length > 0 && $(\"div.row:has(button[type=\\\"submit\\\"])\").length > 0, '确保你的提交按钮和文本输入框都在同一个具有
row class 的 div 元素中。');"
},
{
- "text": "Nest your form text input in a div with the class
col-xs-7.",
- "testString": "assert($(\"div.col-xs-7:has(input[type=\\\"text\\\"])\").length > 0, 'Nest your form text input in a div with the class
col-xs-7.');"
+ "text": "表单的文本输入框应该嵌入到一个具有
col-xs-7 class 的 div 内。",
+ "testString": "assert($(\"div.col-xs-7:has(input[type=\\\"text\\\"])\").length > 0, '表单的文本输入框应该嵌入到一个具有
col-xs-7 class 的 div 内。');"
},
{
- "text": "Nest your form submission button in a div with the class
col-xs-5.",
- "testString": "assert($(\"div.col-xs-5:has(button[type=\\\"submit\\\"])\").length > 0, 'Nest your form submission button in a div with the class
col-xs-5.');"
+ "text": "表单的提交按钮应该嵌入到一个具有
col-xs-5 class 的 div 内。",
+ "testString": "assert($(\"div.col-xs-5:has(button[type=\\\"submit\\\"])\").length > 0, '表单的提交按钮应该嵌入到一个具有
col-xs-5 class 的 div 内。');"
},
{
- "text": "Make sure each of your
div elements has a closing tag.",
- "testString": "assert(code.match(/<\\/div>/g) && code.match(/
/g).length === code.match(/
div elements has a closing tag.');"
+ "text": "确保每一个
div 元素都有一个闭合标签。",
+ "testString": "assert(code.match(/<\\/div>/g) && code.match(/
/g).length === code.match(/
div 元素都有一个闭合标签。');"
}
],
"challengeType": 0,
@@ -1822,31 +1823,31 @@
"id": "bad87fee1348bd9aec908846",
"title": "Create a Bootstrap Headline",
"description": [
- "Now let's build something from scratch to practice our HTML, CSS and Bootstrap skills.",
- "We'll build a jQuery playground, which we'll soon put to use in our jQuery challenges.",
- "To start with, create an
h3 element, with the text
jQuery Playground.",
- "Color your
h3 element with the
text-primary Bootstrap class, and center it with the
text-center Bootstrap class."
+ "现在,让我们运用 HTML,CSS 和 Bootstrap 从零开始做点东西。",
+ "我们将会搭建一个 jQuery playground,以便在后续的 jQuery 课程中使用它。",
+ "首先,创建一个包含
jQuery Playground 文本内容的
h3 元素。",
+ "通过给你的
h3 元素添加 Bootstrap 的
text-primary class 来为其上色,然后添加 Bootstrap 的
text-center class 使其文本居中显示。"
],
"tests": [
{
- "text": "Add a
h3 element to your page.",
- "testString": "assert($(\"h3\") && $(\"h3\").length > 0, 'Add a
h3 element to your page.');"
+ "text": "为你的页面添加一个
h3 元素。",
+ "testString": "assert($(\"h3\") && $(\"h3\").length > 0, '为你的页面添加一个
h3 元素。');"
},
{
- "text": "Make sure your
h3 element has a closing tag.",
- "testString": "assert(code.match(/<\\/h3>/g) && code.match(/
/g).length === code.match(/h3 element has a closing tag.');"
+ "text": "确保你的 h3 元素有一个闭合标签。",
+ "testString": "assert(code.match(/<\\/h3>/g) && code.match(//g).length === code.match(/h3 元素有一个闭合标签。');"
},
{
- "text": "Your h3 element should be colored by applying the class text-primary",
- "testString": "assert($(\"h3\").hasClass(\"text-primary\"), 'Your h3 element should be colored by applying the class text-primary');"
+ "text": "为了确保被上色,你的 h3 元素应该具有 text-primary class。",
+ "testString": "assert($(\"h3\").hasClass(\"text-primary\"), '为了确保被上色,你的 h3 元素应该具有 text-primary class。');"
},
{
- "text": "Your h3 element should be centered by applying the class text-center",
- "testString": "assert($(\"h3\").hasClass(\"text-center\"), 'Your h3 element should be centered by applying the class text-center');"
+ "text": "为了确保文本居中显示,你的 h3 元素应该具有 text-center class。",
+ "testString": "assert($(\"h3\").hasClass(\"text-center\"), '为了确保文本居中显示,你的 h3 元素应该具有 text-center class。');"
},
{
- "text": "Your h3 element should have the text jQuery Playground.",
- "testString": "assert.isTrue((/jquery(\\s)+playground/gi).test($(\"h3\").text()), 'Your h3 element should have the text jQuery Playground.');"
+ "text": "你的 h3 元素需要有文本 jQuery Playground。",
+ "testString": "assert.isTrue((/jquery(\\s)+playground/gi).test($(\"h3\").text()), '你的 h3 元素需要有文本 jQuery Playground。');"
}
],
"challengeType": 0,
@@ -1865,21 +1866,21 @@
"id": "bad87fee1348bd9aec908746",
"title": "House our page within a Bootstrap container-fluid div",
"description": [
- "Now let's make sure all the content on your page is mobile-responsive.",
- "Let's nest your h3 element within a div element with the class container-fluid."
+ "现在让我们确保页面所有内容应该都是响应式的。",
+ "将我们的 h3 元素内嵌进一个具有 container-fluid class 的div 元素中。"
],
"tests": [
{
- "text": "Your div element should have the class container-fluid.",
- "testString": "assert($(\"div\").hasClass(\"container-fluid\"), 'Your div element should have the class container-fluid.');"
+ "text": "你的 div 元素应该具有 container-fluid class。",
+ "testString": "assert($(\"div\").hasClass(\"container-fluid\"), '你的 div 元素应该具有 container-fluid class。');"
},
{
- "text": "Make sure each of your div elements has a closing tag.",
- "testString": "assert(code.match(/<\\/div>/g) && code.match(//g).length === code.match(/
div elements has a closing tag.');"
+ "text": "确保每一个
div 元素都有一个闭合标签。",
+ "testString": "assert(code.match(/<\\/div>/g) && code.match(/
/g).length === code.match(/
div 元素都有一个闭合标签。');"
},
{
- "text": "Nest your
h3 element inside a
div element.",
- "testString": "assert($(\"div\").children(\"h3\").length >0, 'Nest your
h3 element inside a
div element.');"
+ "text": "你的
h3 元素应该内嵌于
div 元素。",
+ "testString": "assert($(\"div\").children(\"h3\").length >0, '你的
h3 元素应该内嵌于
div 元素。');"
}
],
"challengeType": 0,
@@ -1902,25 +1903,25 @@
"id": "bad87fee1348bd9bec908846",
"title": "Create a Bootstrap Row",
"description": [
- "Now we'll create a Bootstrap row for our inline elements.",
- "Create a
div element below the
h3 tag, with a class of
row."
+ "这次我们会为我们的内联元素创建一个 Bootstrap 栅格系统的行(row)。",
+ "在我们的
h3 标签下方创建一个含有
row class 的
div 元素。"
],
"tests": [
{
- "text": "Add a
div element below your
h3 element.",
- "testString": "assert(($(\"div\").length > 1) && ($(\"div.row h3.text-primary\").length == 0) && ($(\"div.row + h3.text-primary\").length == 0) && ($(\"h3.text-primary + div.row\").length > 0), 'Add a
div element below your
h3 element.');"
+ "text": "
h3 元素下增加一个
div 元素。",
+ "testString": "assert(($(\"div\").length > 1) && ($(\"div.row h3.text-primary\").length == 0) && ($(\"div.row + h3.text-primary\").length == 0) && ($(\"h3.text-primary + div.row\").length > 0), '在你的
h3 元素下增加一个
div 元素。');"
},
{
- "text": "Your
div element should have the class
row",
- "testString": "assert($(\"div\").hasClass(\"row\"), 'Your
div element should have the class
row');"
+ "text": "
div 元素的 class 应为
row。",
+ "testString": "assert($(\"div\").hasClass(\"row\"), '
div 元素的 class 应为
row。');"
},
{
- "text": "Your
row div should be nested inside the
container-fluid div",
- "testString": "assert($(\"div.container-fluid div.row\").length > 0, 'Your
row div should be nested inside the
container-fluid div');"
+ "text": "
row div 应该内嵌于
container-fluid div。",
+ "testString": "assert($(\"div.container-fluid div.row\").length > 0, '
row div应该内嵌于
container-fluid div。');"
},
{
- "text": "Make sure your
div element has a closing tag.",
- "testString": "assert(code.match(/<\\/div>/g) && code.match(/
/g).length === code.match(/
div element has a closing tag.');"
+ "text": "确保所有
div 元素都有一个闭合标签。",
+ "testString": "assert(code.match(/<\\/div>/g) && code.match(/
/g).length === code.match(/
div 元素都有一个闭合标签。');"
}
],
"challengeType": 0,
@@ -1945,17 +1946,17 @@
"id": "bad87fee1348bd9aec908847",
"title": "Split Your Bootstrap Row",
"description": [
- "Now that we have a Bootstrap Row, let's split it into two columns to house our elements.",
- "Create two
div elements within your row, both with the class
col-xs-6."
+ "既然我们已经有了一个 Bootstrap 行,就让我们把它分成两列来放置我们的元素。",
+ "在行内创建两个
div 元素,并为它们添加
col-xs-6 class。"
],
"tests": [
{
- "text": "Nest two
div class=\"col-xs-6\" elements within your
div class=\"row\" element.",
- "testString": "assert($(\"div.row > div.col-xs-6\").length > 1, 'Nest two
div class=\"col-xs-6\" elements within your
div class=\"row\" element.');"
+ "text": "将两个
div class=\"col-xs-6\" 元素内嵌入你的
div class=\"row\" 元素中。",
+ "testString": "assert($(\"div.row > div.col-xs-6\").length > 1, '将两个
div class=\"col-xs-6\" 元素内嵌入你的
div class=\"row\" 元素中。');"
},
{
- "text": "Make sure all your
div elements have closing tags.",
- "testString": "assert(code.match(/<\\/div>/g) && code.match(/
/g).length === code.match(/
div elements have closing tags.');"
+ "text": "确保你的
div 元素都有一个闭合标签。",
+ "testString": "assert(code.match(/<\\/div>/g) && code.match(/
/g).length === code.match(/
div 元素都有一个闭合标签。');"
}
],
"challengeType": 0,
@@ -1982,21 +1983,21 @@
"id": "bad87fee1348bd9aec908848",
"title": "Create Bootstrap Wells",
"description": [
- "Bootstrap has a class called
well that can create a visual sense of depth for your columns.",
- "Nest one
div element with the class
well within each of your
col-xs-6 div elements."
+ "Bootstrap 有一个 class 叫做
well,作用是赋予列一种视觉上的深度感(视觉上的效果)。",
+ "在每一个 class 为
col-xs-6 的
div 元素中都嵌入一个带有
well 的
div 元素。"
],
"tests": [
{
- "text": "Add a
div element with the class
well inside each of your
div elements with the class
\"col-xs-6\"",
- "testString": "assert($(\"div.col-xs-6\").not(\":has(>div.well)\").length < 1, 'Add a
div element with the class
well inside each of your
div elements with the class
\"col-xs-6\"');"
+ "text": "在每一个 class 为
\"col-xs-6\" 的
div 元素中都嵌入一个带有
well 的
div 元素。",
+ "testString": "assert($(\"div.col-xs-6\").not(\":has(>div.well)\").length < 1, '在每一个 class 为
\"col-xs-6\" 的
div 元素中都嵌入带有
well 的
div 元素。');"
},
{
- "text": "Nest both of your
div elements with the class
\"col-xs-6\" within your
div element with the class
\"row\".",
- "testString": "assert($(\"div.row > div.col-xs-6\").length > 1, 'Nest both of your
div elements with the class
\"col-xs-6\" within your
div element with the class
\"row\".');"
+ "text": "将你的两个 class 为
\"col-xs-6\" 的
div 元素都内嵌入一个带有
\"row\" 的
div 元素中。",
+ "testString": "assert($(\"div.row > div.col-xs-6\").length > 1, '将你的两个 class 为
\"col-xs-6\" 的
div 元素都内嵌入一个带有
\"row\" 的
div 元素中。');"
},
{
- "text": "Make sure all your
div elements have closing tags.",
- "testString": "assert(code.match(/<\\/div>/g) && code.match(/
/g).length === code.match(/
div elements have closing tags.');"
+ "text": "确保你的
div 元素都有一个闭合标签。",
+ "testString": "assert(code.match(/<\\/div>/g) && code.match(/
/g).length === code.match(/
div 元素都有一个闭合标签。');"
}
],
"challengeType": 0,
@@ -2027,21 +2028,21 @@
"id": "bad87fee1348bd9aec908849",
"title": "Add Elements within Your Bootstrap Wells",
"description": [
- "Now we're several div elements deep on each column of our row. This is as deep as we'll need to go. Now we can add our button elements.",
- "Nest three button elements within each of your well div elements."
+ "现在我们已经每一行的每一列都有了 div 元素。这已经足够了,现在让我们添加 button 元素吧。",
+ "在每一个 well div 元素下放置三个 button 元素。"
],
"tests": [
{
- "text": "Nest three button elements within each of your div elements with class well.",
- "testString": "assert($(\"div.well:eq(0)\").children(\"button\").length === 3 && $(\"div.well:eq(1)\").children(\"button\").length === 3, 'Nest three button elements within each of your div elements with class well.');"
+ "text": "在每一个 well class 的 div 元素内分别放置三个 button 元素。",
+ "testString": "assert($(\"div.well:eq(0)\").children(\"button\").length === 3 && $(\"div.well:eq(1)\").children(\"button\").length === 3, '在每一个 well class 的 div 元素内分别放置三个 button 元素。');"
},
{
- "text": "You should have a total of 6 button elements.",
- "testString": "assert($(\"button\") && $(\"button\").length > 5, 'You should have a total of 6 button elements.');"
+ "text": "你应该总共有 6 个 button 元素。",
+ "testString": "assert($(\"button\") && $(\"button\").length > 5, '你应该总共有 6 个 button 元素。');"
},
{
- "text": "Make sure all your button elements have closing tags.",
- "testString": "assert(code.match(/<\\/button>/g) && code.match(//g).length === code.match(/button elements have closing tags.');"
+ "text": "确保你的 button 元素都有一个闭合标签。",
+ "testString": "assert(code.match(/<\\/button>/g) && code.match(//g).length === code.match(/button 元素都有一个闭合标签。');"
}
],
"challengeType": 0,
@@ -2080,17 +2081,17 @@
"id": "bad87fee1348bd9aec908850",
"title": "Apply the Default Bootstrap Button Style",
"description": [
- "Bootstrap has another button class called btn-default.",
- "Apply both the btn and btn-default classes to each of your button elements."
+ "Bootstrap 还有另外一种属于按钮的 class 叫做 btn-default。",
+ "为你的 button 元素增加两个 class: btn 和 btn-default。"
],
"tests": [
{
- "text": "Apply the btn class to each of your button elements.",
- "testString": "assert($(\".btn\").length > 5, 'Apply the btn class to each of your button elements.');"
+ "text": "将 btn class 添加到你所有的 button 元素中。",
+ "testString": "assert($(\".btn\").length > 5, '将 btn class 添加到你所有的 button 元素中。');"
},
{
- "text": "Apply the btn-default class to each of your button elements.",
- "testString": "assert($(\".btn-default\").length > 5, 'Apply the btn-default class to each of your button elements.');"
+ "text": "将 btn-default class 添加到你每一个 button 元素中。",
+ "testString": "assert($(\".btn-default\").length > 5, '将 btn-default class 添加到你每一个 button 元素中。');"
}
],
"challengeType": 0,
@@ -2130,13 +2131,13 @@
"id": "bad87fee1348bd9aec908852",
"title": "Create a Class to Target with jQuery Selectors",
"description": [
- "Not every class needs to have corresponding CSS. Sometimes we create classes just for the purpose of selecting these elements more easily using jQuery.",
- "Give each of your button elements the class target."
+ "并不是所有 class 都需要有对应的 CSS 样式。有时候我们创建 class 只是为了更方便地在 jQuery 中选中这些元素。",
+ "为你的每一个 button 元素添加 target class。"
],
"tests": [
{
- "text": "Apply the target class to each of your button elements.",
- "testString": "assert($(\".target\").length > 5, 'Apply the target class to each of your button elements.');"
+ "text": "给你的每一个 button 元素设置 target class。",
+ "testString": "assert($(\".target\").length > 5, '给你的每一个 button 元素设置 target class。');"
}
],
"challengeType": 0,
@@ -2175,21 +2176,21 @@
"id": "bad87fee1348bd9aec908853",
"title": "Add id Attributes to Bootstrap Elements",
"description": [
- "Recall that in addition to class attributes, you can give each of your elements an id attribute.",
- "Each id must be unique to a specific element and used only once per page.",
- "Let's give a unique id to each of our div elements of class well.",
- "Remember that you can give an element an id like this:",
+ "回忆一下,除了可以给元素添加 class 属性,我们还可以给元素设置 id 属性。",
+ "每个指定元素的 id 都是唯一的,并且在每个页面中都只能使用一次。",
+ "让我们为每个 class 为 well 的 div 元素添加一个唯一的 id。",
+ "记住,你可以这样给一个元素设置 ID。",
"<div class=\"well\" id=\"center-well\">",
- "Give the well on the left the id of left-well. Give the well on the right the id of right-well."
+ "把左边 well 的 ID 设置为 left-well。右边的 well 的 ID 设置为 right-well。"
],
"tests": [
{
- "text": "Give your left well the id of left-well.",
- "testString": "assert($(\".col-xs-6\").children(\"#left-well\") && $(\".col-xs-6\").children(\"#left-well\").length > 0, 'Give your left well the id of left-well.');"
+ "text": "把左边的 well 的 ID 设置为 left-well。",
+ "testString": "assert($(\".col-xs-6\").children(\"#left-well\") && $(\".col-xs-6\").children(\"#left-well\").length > 0, '把左边的 well 的 ID 设置为 left-well。');"
},
{
- "text": "Give your right well the id of right-well.",
- "testString": "assert($(\".col-xs-6\").children(\"#right-well\") && $(\".col-xs-6\").children(\"#right-well\").length > 0, 'Give your right well the id of right-well.');"
+ "text": "把右边的 well 的 ID 设置为 right-well。",
+ "testString": "assert($(\".col-xs-6\").children(\"#right-well\") && $(\".col-xs-6\").children(\"#right-well\").length > 0, '把右边的 well 的 ID 设置为 right-well。');"
}
],
"challengeType": 0,
@@ -2228,26 +2229,26 @@
"id": "bad87fee1348bd9aec908854",
"title": "Label Bootstrap Wells",
"description": [
- "For the sake of clarity, let's label both of our wells with their ids.",
- "Above your left-well, inside its col-xs-6 div element, add a h4 element with the text #left-well.",
- "Above your right-well, inside its col-xs-6 div element, add a h4 element with the text #right-well."
+ "为了让我们页面逻辑更清晰,让我们为我们的 wells 都标上它们的 id 吧。",
+ "在 left-well 的上一层,class 为 col-xs-6 的 div 元素里面,增加一个文本为 #left-well 的 h4 元素。",
+ "在 right-well 的上一层,class 为 col-xs-6 的 div 元素里面,增加一个文本为 #right-well 的 h4 元素。"
],
"tests": [
{
- "text": "Add an h4 element to each of your <div class=\"col-xs-6\"> elements.",
- "testString": "assert($(\".col-xs-6\").children(\"h4\") && $(\".col-xs-6\").children(\"h4\").length > 1, 'Add an h4 element to each of your <div class=\"col-xs-6\"> elements.');"
+ "text": "为每个 <div class=\"col-xs-6\"> 元素添加一个 h4 元素。",
+ "testString": "assert($(\".col-xs-6\").children(\"h4\") && $(\".col-xs-6\").children(\"h4\").length > 1, '为每个 <div class=\"col-xs-6\"> 元素添加一个 h4 元素。');"
},
{
- "text": "One h4 element should have the text #left-well.",
- "testString": "assert(new RegExp(\"#left-well\",\"gi\").test($(\"h4\").text()), 'One h4 element should have the text #left-well.');"
+ "text": "其中一个 h4 元素应该含有文本内容 #left-well。",
+ "testString": "assert(new RegExp(\"#left-well\",\"gi\").test($(\"h4\").text()), '其中一个 h4 元素应该含有文本内容 #left-well。');"
},
{
- "text": "One h4 element should have the text #right-well.",
- "testString": "assert(new RegExp(\"#right-well\",\"gi\").test($(\"h4\").text()), 'One h4 element should have the text #right-well.');"
+ "text": "其中一个 h4 元素应该含有文本内容 #right-well。",
+ "testString": "assert(new RegExp(\"#right-well\",\"gi\").test($(\"h4\").text()), '其中一个 h4 元素应该含有文本内容 #right-well。');"
},
{
- "text": "Make sure all your h4 elements have closing tags.",
- "testString": "assert(code.match(/<\\/h4>/g) && code.match(//g).length === code.match(/h4 elements have closing tags.');"
+ "text": "确保你的每个 h4 元素都有一个闭合标签。",
+ "testString": "assert(code.match(/<\\/h4>/g) && code.match(//g).length === code.match(/h4 元素都有一个闭合标签。');"
}
],
"challengeType": 0,
@@ -2288,34 +2289,34 @@
"id": "bad87fee1348bd9aec908855",
"title": "Give Each Element a Unique id",
"description": [
- "We will also want to be able to use jQuery to target each button by its unique id.",
- "Give each of your buttons a unique id, starting with target1 and ending with target6.",
- "Make sure that target1 to target3 are in #left-well, and target4 to target6 are in #right-well."
+ "我们也可以使用 jQuery 通过每个按钮各自唯一的 id 来标识出它们。We will also want to be able to use jQuery to target each button by its unique id.",
+ "给你的每一个按钮一个唯一的 id,以 target1 开始,target6 结束。",
+ "确保 target1 到 target3 在 #left-well 之中,target4 到 target6 在 #right-well 之中。"
],
"tests": [
{
- "text": "One button element should have the id target1.",
- "testString": "assert($(\"#left-well\").children(\"#target1\") && $(\"#left-well\").children(\"#target1\").length > 0, 'One button element should have the id target1.');"
+ "text": "其中一个 button 元素应该有 id target1。",
+ "testString": "assert($(\"#left-well\").children(\"#target1\") && $(\"#left-well\").children(\"#target1\").length > 0, '其中一个 button 元素应该有 id target1。');"
},
{
- "text": "One button element should have the id target2.",
- "testString": "assert($(\"#left-well\").children(\"#target2\") && $(\"#left-well\").children(\"#target2\").length > 0, 'One button element should have the id target2.');"
+ "text": "其中一个 button 元素应该有 id target2。",
+ "testString": "assert($(\"#left-well\").children(\"#target2\") && $(\"#left-well\").children(\"#target2\").length > 0, '其中一个 button 元素应该有 id target2。');"
},
{
- "text": "One button element should have the id target3.",
- "testString": "assert($(\"#left-well\").children(\"#target3\") && $(\"#left-well\").children(\"#target3\").length > 0, 'One button element should have the id target3.');"
+ "text": "其中一个 button 元素应该有 id target3。",
+ "testString": "assert($(\"#left-well\").children(\"#target3\") && $(\"#left-well\").children(\"#target3\").length > 0, '其中一个 button 元素应该有 id target3。');"
},
{
- "text": "One button element should have the id target4.",
- "testString": "assert($(\"#right-well\").children(\"#target4\") && $(\"#right-well\").children(\"#target4\").length > 0, 'One button element should have the id target4.');"
+ "text": "其中一个 button 元素应该有 id target4。",
+ "testString": "assert($(\"#right-well\").children(\"#target4\") && $(\"#right-well\").children(\"#target4\").length > 0, '其中一个 button 元素应该有 id target4。');"
},
{
- "text": "One button element should have the id target5.",
- "testString": "assert($(\"#right-well\").children(\"#target5\") && $(\"#right-well\").children(\"#target5\").length > 0, 'One button element should have the id target5.');"
+ "text": "其中一个 button 元素应该有 id target5。",
+ "testString": "assert($(\"#right-well\").children(\"#target5\") && $(\"#right-well\").children(\"#target5\").length > 0, '其中一个 button 元素应该有 id target5。');"
},
{
- "text": "One button element should have the id target6.",
- "testString": "assert($(\"#right-well\").children(\"#target6\") && $(\"#right-well\").children(\"#target6\").length > 0, 'One button element should have the id target6.');"
+ "text": "其中一个 button 元素应该有 id target6。",
+ "testString": "assert($(\"#right-well\").children(\"#target6\") && $(\"#right-well\").children(\"#target6\").length > 0, '其中一个 button 元素应该有 id target6。');"
}
],
"challengeType": 0,
@@ -2356,33 +2357,33 @@
"id": "bad87fee1348bd9aec908856",
"title": "Label Bootstrap Buttons",
"description": [
- "Just like we labeled our wells, we want to label our buttons.",
- "Give each of your button elements text that corresponds to its id's selector."
+ "正如我们标注了每个 wells 一样,我们同样想要标注每一个按钮。",
+ "为每一个 button 元素选择与其 id 选择器相同的文本。"
],
"tests": [
{
- "text": "Give your button element with the id target1 the text #target1.",
- "testString": "assert(new RegExp(\"#target1\",\"gi\").test($(\"#target1\").text()), 'Give your button element with the id target1 the text #target1.');"
+ "text": "给 id 为 target1 的 button 元素设置文本 #target1。",
+ "testString": "assert(new RegExp(\"#target1\",\"gi\").test($(\"#target1\").text()), '给 id 为 target1 的 button 元素设置文本 #target1。');"
},
{
- "text": "Give your button element with the id target2 the text #target2.",
- "testString": "assert(new RegExp(\"#target2\",\"gi\").test($(\"#target2\").text()), 'Give your button element with the id target2 the text #target2.');"
+ "text": "给 id 为 target2 的 button 元素设置文本 #target2。",
+ "testString": "assert(new RegExp(\"#target2\",\"gi\").test($(\"#target2\").text()), '给 id 为 target2 的 button 元素设置文本 #target2。');"
},
{
- "text": "Give your button element with the id target3 the text #target3.",
- "testString": "assert(new RegExp(\"#target3\",\"gi\").test($(\"#target3\").text()), 'Give your button element with the id target3 the text #target3.');"
+ "text": "给 id 为 target3 的 button 元素设置文本 #target3。",
+ "testString": "assert(new RegExp(\"#target3\",\"gi\").test($(\"#target3\").text()), '给 id 为 target3 的 button 元素设置文本 #target3。');"
},
{
- "text": "Give your button element with the id target4 the text #target4.",
- "testString": "assert(new RegExp(\"#target4\",\"gi\").test($(\"#target4\").text()), 'Give your button element with the id target4 the text #target4.');"
+ "text": "给 id 为 target4 的 button 元素设置文本 #target4。",
+ "testString": "assert(new RegExp(\"#target4\",\"gi\").test($(\"#target4\").text()), '给 id 为 target4 的 button 元素设置文本 #target4。');"
},
{
- "text": "Give your button element with the id target5 the text #target5.",
- "testString": "assert(new RegExp(\"#target5\",\"gi\").test($(\"#target5\").text()), 'Give your button element with the id target5 the text #target5.');"
+ "text": "给 id 为 target5 的 button 元素设置文本 #target5。",
+ "testString": "assert(new RegExp(\"#target5\",\"gi\").test($(\"#target5\").text()), '给 id 为 target5 的 button 元素设置文本 #target5。');"
},
{
- "text": "Give your button element with the id target6 the text #target6.",
- "testString": "assert(new RegExp(\"#target6\",\"gi\").test($(\"#target6\").text()), 'Give your button element with the id target6 the text #target6.');"
+ "text": "给 id 为 target6 的 button 元素设置文本 #target6。",
+ "testString": "assert(new RegExp(\"#target6\",\"gi\").test($(\"#target6\").text()), '给 id 为 target6 的 button 元素设置文本 #target6。');"
}
],
"challengeType": 0,
@@ -2423,27 +2424,27 @@
"id": "bad87fee1348bd9aec908857",
"title": "Use Comments to Clarify Code",
"description": [
- "When we start using jQuery, we will modify HTML elements without needing to actually change them in HTML.",
- "Let's make sure that everyone knows they shouldn't actually modify any of this code directly.",
- "Remember that you can start a comment with <!-- and end a comment with -->",
- "Add a comment at the top of your HTML that says Only change code above this line."
+ "当我们开始使用 jQuery,我们将修改HTML元素,但是实际上我们并不是直接在 HTML 文本中修改。",
+ "我们必须确保让每个人都知道,他们不应该直接修改此页面上这些代码。",
+ "记住,你可以在 <!-- 为开始,--> 为结束的地方进行评论注释(像这样,<!-- 我是一段注释 -->)。",
+ "请你在你的 HTML 顶部加如下一段注释: Only change code above this line. 。"
],
"tests": [
{
- "text": "Start a comment with <!-- at the top of your HTML.",
- "testString": "assert(code.match(/^\\s*.*this line))\\s*.*this line.*\\s*-->/gi), 'Your comment should have the text Only change code above this line.');"
+ "text": "注释内容应该为 Only change code above this line。",
+ "testString": "assert(code.match(/.*this line))\\s*.*this line.*\\s*-->/gi), '你的注释内容应该为 Only change code above this line。');"
},
{
- "text": "Be sure to close your comment with -->.",
- "testString": "assert(code.match(/-->.*\\n+.+/g), 'Be sure to close your comment with -->.');"
+ "text": "注释应该用 --> 进行闭合。",
+ "testString": "assert(code.match(/-->.*\\n+.+/g), '注释应该用 --> 进行闭合。');"
},
{
- "text": "You should have the same number of comment openers and closers.",
- "testString": "assert(code.match(//g).length, 'You should have the same number of comment openers and closers.');"
+ "text": "注意,注释的开始标签和闭合标签数量应该一一对应,保持数量一致。",
+ "testString": "assert(code.match(//g).length, '注意,注释的开始标签和闭合标签数量应该一一对应,保持数量一致。');"
}
],
"challengeType": 0,
@@ -2481,4 +2482,4 @@
}
}
]
-}
\ No newline at end of file
+}
diff --git a/03-front-end-libraries/bootstrap.md b/03-front-end-libraries/bootstrap.md
index fe21a10..1110703 100644
--- a/03-front-end-libraries/bootstrap.md
+++ b/03-front-end-libraries/bootstrap.md
@@ -1,11 +1,11 @@
# Introduction to the Bootstrap Challenges #
-Bootstrap is a front-end framework used to design responsive web pages and web applications. It takes a mobile-first approach to web development. Bootstrap includes pre-built CSS styles and classes, plus some JavaScript functionality. Bootstrap uses a responsive 12 column grid layout and has design templates for:
+Bootstrap 是一个用于设计响应式网页和网络应用的前端框架。具有移动优先的特点。Bootstrap 具有预定义的 CSS 样式和类,还有一些 JavaScript 功能。Bootstrap 使用响应式的12列栅格布局并提供了一些设计模板:
-* buttons
-* images
-* tables
-* forms
-* navigation
+* 按钮
+* 图片
+* 表格
+* 表单
+* 导航
-This section introduces some of the ways to use Bootstrap in your web projects.
+这个章节介绍了如何使用 Bootstrap 来设计响应式界面。