* feat(tools): add seed/solution restore script * chore(curriculum): remove empty sections' markers * chore(curriculum): add seed + solution to Chinese * chore: remove old formatter * fix: update getChallenges parse translated challenges separately, without reference to the source * chore(curriculum): add dashedName to English * chore(curriculum): add dashedName to Chinese * refactor: remove unused challenge property 'name' * fix: relax dashedName requirement * fix: stray tag Remove stray `pre` tag from challenge file. Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
61 lines
1019 B
Markdown
61 lines
1019 B
Markdown
---
|
|
id: bad87fee1348bd9aedf08801
|
|
title: 用 p 元素代表段落
|
|
challengeType: 0
|
|
videoUrl: 'https://scrimba.com/p/pVMPUv/ceZ7DtN'
|
|
forumTopicId: 18202
|
|
dashedName: inform-with-the-paragraph-element
|
|
---
|
|
|
|
# --description--
|
|
|
|
`p` 是 `paragraph` 的缩写,通常用来创建一个段落,就和你写作文一样。
|
|
|
|
你可以像这样创建一个段落:
|
|
|
|
`<p>I'm a p tag!</p>`
|
|
|
|
# --instructions--
|
|
|
|
请在 `h2` 元素下方添加一个 `p` 元素,元素内容是 `Hello Paragraph`。
|
|
|
|
# --hints--
|
|
|
|
应包含一个 `p` 元素。
|
|
|
|
```js
|
|
assert($('p').length > 0);
|
|
```
|
|
|
|
`p` 元素的内容文本应为 `Hello Paragraph`。
|
|
|
|
```js
|
|
assert.isTrue(/hello(\s)+paragraph/gi.test($('p').text()));
|
|
```
|
|
|
|
`p` 元素应有结束标签。
|
|
|
|
```js
|
|
assert(
|
|
code.match(/<\/p>/g) &&
|
|
code.match(/<\/p>/g).length === code.match(/<p/g).length
|
|
);
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
```html
|
|
<h1>Hello World</h1>
|
|
<h2>CatPhotoApp</h2>
|
|
```
|
|
|
|
# --solutions--
|
|
|
|
```html
|
|
<h1>Hello World</h1>
|
|
<h2>CatPhotoApp</h2>
|
|
<p>Hello Paragraph</p>
|
|
```
|