Compared to XHTML, HTML5 provokes a series of thoughts through simpler elements. Frankly speaking, this is a much-needed simplification. One of these simplifications is the ability to wrap block-level elements like divs, h tags (h1...h6), and paragraph tags P through the tag. You read that right: Use an A tag to wrap a block-level element (Translator's Note: Before HTML5, the a tag was an inline element, while div, h1, p, etc. were block-level elements. If you wrap it forcibly, it may be forcibly truncated. Multiple a tags. Of course, it’s all about the browser).
Sample code:
What do you think?
I'm conflicted about using A tags to contain block-level elements, it looks like a bunch of junk code at a quick glance. On the other hand, in order to avoid this approach, we have been using JavaScript to handle it. The purpose of clickable elements is to complete tasks and functions, and using native HTML to complete this function is more natural than JS, and it is definitely convenient sometimes. What I want to ask is: What do you think of this practice? Can you use it immediately? Please share your views! (Translator’s note: In the translator’s project, a team member used this function. It’s very sad to see it in MyEclipse because there are a lot of yellow warnings. But objectively speaking, sometimes some codes are indeed Very effective, like something like
)