freeCodeCamp/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-html-forms-by-buildin.../60f027c87bc98f050395c139.md

1.1 KiB

id title challengeType dashedName
60f027c87bc98f050395c139 步驟 3 0 step-3

--description--

接下來,在 html 元素中添加 headbody 的開始和結束標籤。

--hints--

應該有一個 head 開始標籤。

assert(code.match(/<head\s*>/i));

應該有一個 head 結束標籤。

assert(code.match(/<\/head\s*>/i));

應該有一個 body 開始標籤。

assert(code.match(/<body\s*>/i));

應該有一個 body 結束標籤。

assert(code.match(/<\/body\s*>/i));

headbody 元素應該是同級元素。

assert(document.querySelector('head')?.nextElementSibling.localName === 'body');

head 元素應該在 html 元素內。

assert([...document.querySelector('html')?.children].some(x => x?.localName === 'head'));

body 元素應該在 html 元素內。

assert([...document.querySelector('html')?.children].some(x => x?.localName === 'body'));

--seed--

--seed-contents--

--fcc-editable-region--
<!DOCTYPE html>
<html lang="en">

</html>
--fcc-editable-region--