Why is position: relative required for <a> to work in a DIV?

徘徊边缘 提交于 2019-12-13 11:05:04

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!