Skip to content

[html] 第274天 列举下哪些块元素里面不能放哪些块元素呢? #1776

Open
@haizhilin2013

Description

@haizhilin2013

第274天 列举下哪些块元素里面不能放哪些块元素呢?

我也要出题

Activity

wangxudongcc

wangxudongcc commented on Jan 15, 2020

@wangxudongcc

有answer吗?

forever-z-133

forever-z-133 commented on Jan 15, 2020

@forever-z-133

其实如果是 append 的话都能放

liwudi

liwudi commented on Jan 17, 2020

@liwudi

p、h1、...、h6等不能嵌套块级元素。
ul、ol、table、dl等内部必须是固定的元素。

Wyt-GitHub8000

Wyt-GitHub8000 commented on Mar 30, 2023

@Wyt-GitHub8000

在 HTML 中,一些块级元素(block-level elements)是不能被包含在其他一些块级元素内的。以下是一些示例:

p 元素不能包含其他的块级元素,只能包含行内元素。
ul 和 ol 元素只能包含 li 元素。
dl 元素只能包含 dt 和 dd 元素。
fieldset 元素只能包含 legend 元素和表单元素。
form 元素只能包含表单元素。
table 元素只能包含 thead、tbody 和 tfoot 元素以及 tr 元素。
需要注意的是,HTML5 规范中允许 p 元素内直接包含 img、video、audio、canvas、meter、progress 和 math 这些元素,这些元素被认为是类似于文字的“替换元素”(replaced elements)。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @haizhilin2013@forever-z-133@liwudi@wangxudongcc@Wyt-GitHub8000

        Issue actions

          [html] 第274天 列举下哪些块元素里面不能放哪些块元素呢? · Issue #1776 · haizlin/fe-interview