2.7 KiB
2.7 KiB
id, challengeType, videoUrl, forumTopicId, title
id | challengeType | videoUrl | forumTopicId | title |
---|---|---|---|---|
bad87fee1348bd9aede08835 | 0 | https://scrimba.com/p/pVMPUv/cNW4kC3 | 18246 | 元素嵌套 |
Description
div
元素,也叫 Content Division Element(内容划分元素)元素,是一个包裹其他元素的通用容器。
它也是 HTML 中出现频率最高的元素。
和其他普通元素一样,你可以用<div>
来标记一个div
元素的开始,用</div>
来标记一个div
元素的结束。
Instructions
div
元素。
提示:你可以在第一个<p>
之前插入div
开始标记,在</ol>
之后插入div
结束标记,这样,所有的列表都位于div
之内。
Tests
tests:
- text: '把所有的<code>p</code>元素嵌入<code>div</code>元素中。'
testString: assert($("div").children("p").length > 1);
- text: '把<code>ul</code>元素嵌入<code>div</code>元素中。'
testString: assert($("div").children("ul").length > 0);
- text: '把<code>ol</code>元素嵌入<code>div</code>元素中。'
testString: assert($("div").children("ol").length > 0);
- text: '确保<code>div</code>元素有结束标记。'
testString: assert(code.match(/<\/div>/g) && code.match(/<\/div>/g).length === code.match(/<div>/g).length);
Challenge Seed
<h2>CatPhotoApp</h2>
<main>
<p>点击查看更多<a href="#">猫咪图片</a>。</p>
<a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="一只仰卧着的萌猫"></a>
<p>猫咪最喜欢的三件东西:</p>
<ul>
<li>猫薄荷</li>
<li>激光笔</li>
<li>千层饼</li>
</ul>
<p>猫咪最讨厌的三件东西:</p>
<ol>
<li>跳蚤</li>
<li>打雷</li>
<li>同类</li>
</ol>
<form action="https://freecatphotoapp.com/submit-cat-photo">
<label><input type="radio" name="indoor-outdoor">室内</label>
<label><input type="radio" name="indoor-outdoor">室外</label><br>
<label><input type="checkbox" name="personality">忠诚</label>
<label><input type="checkbox" name="personality">懒惰</label>
<label><input type="checkbox" name="personality">积极</label><br>
<input type="text" placeholder="猫咪图片地址" required>
<button type="submit">提交</button>
</form>
</main>