Home  >  Article  >  Web Front-end  >  Summary of the reasons why the a tag cannot be clicked after the element is absolutely positioned and the height and width are set.

Summary of the reasons why the a tag cannot be clicked after the element is absolutely positioned and the height and width are set.

WBOY
WBOYOriginal
2016-09-09 08:13:211395browse

After the element is absolutely positioned and the height and width are set, the reason why the a tag cannot be clicked:

1. There is no content in the element

2. The background is transparent, without any background image or color

Solution:

1. If the element is not positioned absolutely, you can use relative positioning

2. Add a transparent background image to the element

3. IE can only use background:url(about:blank) to solve it

The third method can be used normally, but there will be bugs in certain situations. For example, when dragging a layer with JS, the dragging event is on a transparent layer, and you have set other mouse cursors. At this time, dragging The cursor will flash when you move it!

Summary: Use the second method, just make a 1*1PX transparent image!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn