Sample Code for HTML5 placing block-level elements in tag a _ html5 tutorial-

Source: Internet
Author: User
You are not mistaken: A label is used to wrap block-level elements. Before HTML5, a label belongs to the intra-row elements, while div, h1, and p are block-level elements. If A label is forcibly wrapped, may be forcibly truncated into multiple a tags. Interested friends can learn more. In comparison to XHTML, HTML5 has caused a series of ideas through simpler elements. Honestly, this is a much-needed simplification. One of these simplification is the ability to encapsulate block-level elements like p, h tags (h1... h6), and paragraph tags like P. You are not mistaken: A label is used to enclose block-level elements. (Note: Before HTML5, a label is A line-level element, while p, h1, and p are block-level elements, if a package is forcibly wrapped, multiple a labels may be forcibly truncated. Of course, it's all about browsers .).

Sample Code:

The Code is as follows:





About David Walsh


The author is a 27-year-old Web Developer and an expert consultant on jQuery & MooTools. The address is Madison and Wisconsin. it is also the founder and master of Wynq Web lab. motto: "I don't design websites, just let them run."






In this case, an A tag contains elements such as p, p, and h1. You must note that you cannot include another A tag in A tag. Otherwise, what will happen, it may be caused by different browsers.

What do you think?
I am in conflict with the block-level elements contained in tag A, and it feels like A bunch of junk code During Quick View. On the other hand, we have been using JavaScript to avoid this approach. Clickable elements are designed to accomplish tasks and functions. Native HTML is more natural than JS, and sometimes it is very convenient. What do you think of this practice? Can you use it immediately? Please share your opinion!
(Translator's note: In the translator's project, a member uses this function. It looks sad in MyEclipse, because it is a bunch of yellow warnings. But objectively speaking, sometimes some code is very effective, such )

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.