web中自定義鼠標(biāo)樣式_html/css_WEB-ITnose
來(lái)源:懂視網(wǎng)
責(zé)編:小采
時(shí)間:2020-11-27 15:53:29
web中自定義鼠標(biāo)樣式_html/css_WEB-ITnose
web中自定義鼠標(biāo)樣式_html/css_WEB-ITnose:最近寫(xiě)項(xiàng)目需要實(shí)現(xiàn)一個(gè)功能:鼠標(biāo)移動(dòng)到一個(gè)圖片左邊顯示左箭頭,移動(dòng)到右邊顯示右箭頭。 實(shí)現(xiàn)方法:一個(gè)img上面定位兩個(gè)div,div的樣式如下: .toleft { width: 200px; height: 300px; position: absolute; left: 0px; top
導(dǎo)讀web中自定義鼠標(biāo)樣式_html/css_WEB-ITnose:最近寫(xiě)項(xiàng)目需要實(shí)現(xiàn)一個(gè)功能:鼠標(biāo)移動(dòng)到一個(gè)圖片左邊顯示左箭頭,移動(dòng)到右邊顯示右箭頭。 實(shí)現(xiàn)方法:一個(gè)img上面定位兩個(gè)div,div的樣式如下: .toleft { width: 200px; height: 300px; position: absolute; left: 0px; top

最近寫(xiě)項(xiàng)目需要實(shí)現(xiàn)一個(gè)功能:鼠標(biāo)移動(dòng)到一個(gè)圖片左邊顯示左箭頭,移動(dòng)到右邊顯示右箭頭。
實(shí)現(xiàn)方法:一個(gè)img上面定位兩個(gè)div,div的樣式如下:
.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; }
其他瀏覽器還好,可就是ie里面不行。
后來(lái)試了幾種方法:
1.給 img 加 z-idnex:1 ; 給 div 加 z-index:2 //不行
2.把 div 的 position:absolute 去掉,加上float:left; //不行
無(wú)奈,后來(lái)給 div 加了個(gè)background-color:#fff; 嘿,居然可以了。
最后再把div的透明度設(shè)為0就ok了。
聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
web中自定義鼠標(biāo)樣式_html/css_WEB-ITnose
web中自定義鼠標(biāo)樣式_html/css_WEB-ITnose:最近寫(xiě)項(xiàng)目需要實(shí)現(xiàn)一個(gè)功能:鼠標(biāo)移動(dòng)到一個(gè)圖片左邊顯示左箭頭,移動(dòng)到右邊顯示右箭頭。 實(shí)現(xiàn)方法:一個(gè)img上面定位兩個(gè)div,div的樣式如下: .toleft { width: 200px; height: 300px; position: absolute; left: 0px; top