X Tutup
The Wayback Machine - https://web.archive.org/web/20210202135950/https://github.com/haizlin/fe-interview/issues/2713
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[html] 第472天 什么是空元素?常用的空元素有哪些? #2713

Open
haizhilin2013 opened this issue Jul 30, 2020 · 3 comments
Open

[html] 第472天 什么是空元素?常用的空元素有哪些? #2713

haizhilin2013 opened this issue Jul 30, 2020 · 3 comments
Labels

Comments

@haizhilin2013
Copy link
Collaborator

@haizhilin2013 haizhilin2013 commented Jul 30, 2020

第472天 什么是空元素?常用的空元素有哪些?

3+1官网

我也要出题

@haizhilin2013 haizhilin2013 added the html label Jul 30, 2020
@xiaowang1314
Copy link

@xiaowang1314 xiaowang1314 commented Jul 30, 2020


没有闭合标签的元素是空元素

@TRUEJASONFANS
Copy link

@TRUEJASONFANS TRUEJASONFANS commented Jul 31, 2020

一个空元素(empty element)可能是 HTML,SVG,或者 MathML 里的一个不能存在子节点(例如内嵌的元素或者元素内的文本)的element。

HTML,SVG 和 MathML 的规范都详细定义了每个元素能包含的具体内容(define very precisely what each element can contain)。许多组合是没有任何语义含义的,比如一个 <audio> 元素嵌套在一个 <hr> 元素里。

在 HTML 中,通常在一个空元素上使用一个闭标签是无效的。例如, <input type="text"></input> 的闭标签是无效的 HTML。

在 HTML 中有以下这些空元素:

<area>
<base>
<br>
<col>
<colgroup> when the span is present
<command>
<embed>
<hr>
<img>
<input>
<keygen>
<link>
<meta>
<param>
<source>
<track>
<wbr>
@Atrongant
Copy link

@Atrongant Atrongant commented Aug 18, 2020

单标签元素就是空元素。常用的img,hr,br,link,input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
X Tutup