freeCodeCamp/curriculum/challenges/chinese-traditional/01-responsive-web-design/basic-html-and-html5/comment-out-html.md

1.5 KiB

id title challengeType videoUrl forumTopicId dashedName
bad87fee1348bd9aedf08804 給 HTML 添加註釋 0 https://scrimba.com/p/pVMPUv/cGyGbca 16782 comment-out-html

--description--

記住:註釋的開始標記是 <!--,結束標記是 -->

現在你需要在 h2 元素開始前終止註釋。

--instructions--

註釋掉 h1 元素和 p 元素,保留 h2 元素。

--hints--

應註釋掉 h1 元素,這樣它就從網頁上消失了。

assert($('h1').length === 0);

h2 元素應保持原樣,這樣網頁上還能看到它。

assert($('h2').length > 0);

應註釋掉 p 元素,這樣它就從網頁上消失了。

assert($('p').length === 0);

每一個註釋都應以 --> 結尾。

assert(code.match(/[^fc]-->/g).length > 1);

不要更改 h1 元素、h2 元素、p 元素的順序。

assert(
  code.match(/<([a-z0-9]){1,2}>/g)[0] === '<h1>' &&
    code.match(/<([a-z0-9]){1,2}>/g)[1] === '<h2>' &&
    code.match(/<([a-z0-9]){1,2}>/g)[2] === '<p>'
);

--seed--

--seed-contents--

<!--
<h1>Hello World</h1>

<h2>CatPhotoApp</h2>

<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
-->

--solutions--

<!--<h1>Hello World</h1>-->
<h2>CatPhotoApp</h2> 
<!--<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p> -->