In contrast to XHTML, HTML5 a series of reflections through simpler elements, and frankly, this is really a much-needed simplification. One of these simplifications is the ability to wrap the block-level elements like div,h tags (h1...h6), and paragraph mark p through <a> labels. You're right: use a tag to wrap block-level elements (translator Note: Before HTML5, a label belongs to the inline element, and Div,h1,p is a block-level element, and if forced, it may be forcibly truncated to multiple a tags.) Of course, it's all about browsers. ).
Sample code:
Copy Code code as follows:
<body>
<a href= "/about-page.php" >
<div class= "article" >
<h1> about David walsh</h1>
<p>
The original author is a 27-year-old Web Developer and is an expert advisor on jquery & MooTools, Madison, Wisconsin,
. It is also the founder and master of Wynq Web Labs. Motto: "I don't design websites, just let them run."
</p>
</div>
</a>
</body>
that is, a label for a is wrapped around an element like div,p,h1, and it should be noted that you cannot include another a tag within a label, otherwise what happens is likely to be inconsistent across browsers.
What do you think of it? The
is contradictory to the inclusion of a block-level element with a label, and it feels like a bunch of junk code when you view it quickly. On the other hand, to avoid this, we always use JavaScript to handle it. Clickable elements are designed to accomplish tasks and functions, and using native HTML to do this is more natural than JS, and is sometimes certainly convenient. What I want to ask is: What do you think of this practice? Can you use it immediately? Please share your views!
(translator: In the translator's project, a team member uses this function.) It's hard to look inside the myeclipse because it's a bunch of yellow warnings. But objectively, sometimes some code works really well, like something <red>.