如何写出开头和结尾主标记?。。。

如何写出开头和结尾主标记?。。。
0

#1

Tell us what’s happening:

Your code so far


<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>

<p> Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
main

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/responsive-web-design/basic-html-and-html5/introduction-to-html5-elements


#2

I don’t speak chinese but you need to wrap your 2 paragraphs inside <main> tags. For ex.

<main>
<div>Hello World</div>
<p>Hi World </p>
</main>

#3

这个 challenge 有两个要求:

  1. 必须有两个段落(<p>)元素(这项已经实现了)
  2. 两个段落的父元素是一个主体(<main>)元素

父子元素是这样嵌套的:

<父>
  <子>文字内容</子>
  <子>……</子>
  <子>……</子>
  ……等等
</父>

#4

It looks so cool to see something coded in chinese, I am learning Japanese so I can actually understand some of the hanzis like the one of the father and the child.


#5

In Chinese, those characters can also be used to mean parent and child elements in tree structures like HTML documents. :grin:

I should note that those are just placeholders for use in my explanation — they won’t work in an HTML document, at least not “out-of-the-box”… Curiously, #1 below fails to create the desired element in Chrome, but #2 succeeds. I’m guessing this is due to subtleties of the HTML and/or JavaScript specs, but I’ve yet to find the exact reasons.

// #1 (fails)
parentDiv.innerHTML = '<文></文>';

// #2 (succeeds)
const 文 = document.createElement('文'); //yes, this can also be the name of a variable in JavaScript!
parentDiv.appendChild(文);