Nested rules for HTML tags

Source: Internet
Author: User

First, HTML tags include block-level elements (blocks), inline elements (inline)

1, block-level elements

Generally used to build Web site architecture, layout, hosting content ... It includes the following tags:

Address, blockquote, center, dir, Div, DL, DT, DD, fieldset, form, H1~h6, HR, Isindex, menu, Noframes, NoScript,
OL, p, Pre, table, UL
2. Embedded elements

Some of the details or parts of the site are generally used to "emphasize, differentiate style, superscript, subscript, anchor" and so on, these tags are embedded elements:

A, ABBR, acronym, B, BDO, big, BR, cite, code, DFN, EM, font, I, IMG, input, KBD, label, Q, S, Samp, select,
Small, span, strike, strong, sub, SUP, textarea, TT, U, var

Ii. nested rules for HTML tags
1. Block elements can contain inline elements or some block elements, but inline elements cannot contain block elements, which can contain only other inline elements:

<div>
<a href= "#" ><span></span></a>--to

<span><div></div></span>--wrong
2. Block-level elements cannot be placed in <p>:

<p><ol><li></li></ol></p>--wrong

<p><div></div></p>--wrong
3. There are several special block-level elements that can contain only inline elements and no longer contain block-level elements, which are the following special tags:

H1, H2, H3, H4, H5, H6, p, DT
4. Li can contain div tags-this one is not necessarily listed separately, but many people on the internet have some doubts about it, here slightly explain:

Both Li and div tags are containers for loading content, with equal status and no rank (e.g. H1, H2, hierarchical hierarchy ^_^)
, you know, Li Tag even its parent UL or OL can be accommodated, why would someone think Li just can't fit a div?
Do not see Li so stingy, don't look at Li is very small, in fact, Li is very broad-minded.
5. Block-level elements are tied to block-level elements, inline elements and inline elements:

<div>
<div><a href= "#" ></a><span></span></div>--to

<div>

Nested rules for HTML tags

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.