问题
Why is position: relative required for the hyperlink = <a> to work in a DIV?
If there is no position, the link does not work?
回答1:
position:relative isn't needed for the < a > tag to work in a div. The link should work regardless.
However, tags tend to be naturally inline elements rather than block elements. So maybe that's why you're having errors?
Or you're talking about the inverse, which is the div is a block, and you put the div into an inline element so it doesn't work. Which is just a property of inline elements in HTML 4.
HTML 5 states that the element "may be wrapped around entire paragraphs, lists, tables, and so forth, even entire sections, so long as there is no interactive content within (e.g. buttons or other links)".
来源:https://stackoverflow.com/questions/58479446/why-is-position-relative-required-for-a-to-work-in-a-div