最近写项目需要实现一个功能:鼠标移动到一个图片左边显示左箭头,移动到右边显示右箭头。
Implementation method: Position two divs on an img. The style of the divs is as follows:
.toleft { width: 200px; height: 300px; position: absolute; left: 0px; top: 0px; cursor: url(../images/test/cursor_left.cur), default; } .toright { width: 200px; height: 300px; position: absolute; left: 200px; top: 0px; cursor: url(../images/test/cursor_right.cur), default; }
Others The browser is fine, but it just doesn't work in IE.
Later I tried several methods:
1. Add z-idnex:1 to img; Add z-index:2 to div //Not working
2. Remove the position:absolute from the div and add float:left; //No way
I had no choice but to add a background-color to the div: #fff; Hey, it actually works.
Finally, set the transparency of the div to 0 and it will be ok.