Comments: 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 wrap block-level elements like div, h tag (h1... h6), and paragraph tags like P through the <a> label. You are not mistaken: A label is used to enclose block-level elements. (Note: Before HTML5, a label is A line-level element, while div, 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:
<Body>
<A href = "/about-page.php">
<Div class = "article">
<H1> about David Walsh <P>
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."
</P>
</Div>
</A>
</Body>
In this case, A tag A contains elements such as div, p, and h1. You must note that you cannot include another tag A 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 as <red>)