cursor:指针不工作在:元素之后? [英] cursor: pointer doesn't work on :after element?

查看:132
本文介绍了cursor:指针不工作在:元素之后?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在chrome中查看这个,似乎不能得到cursor:指针工作在:after元素之后。有办法解决这个问题吗?

I'm viewing this in chrome and can't seem to get cursor: pointer to work on the :after element of li. Is there a way to get around this?

http://jsfiddle.net / qKMPQ / 2 /

推荐答案

而不是设置 cursor:pointer :之后元素,将它设置在整个 li ,它会显示在两者上。

Instead of setting the cursor: pointer on the :after element, set it on the entire li and it will show up on both.

编辑

对于那些试图在 li 和它的:after 伪元素后,您只需要显式定义 cursor li 中的内容。查看此更新的小提琴: http://jsfiddle.net/qKMPQ/20/


For those of you trying to have different cursors on the li and its :after pseudo-element, you simply need to explicitly define the cursor property of the content inside the li. See this updated fiddle: http://jsfiddle.net/qKMPQ/20/

<ul>
    <li>
        <a href="#"></a>
    </li>
</ul>



ul { list-style-type: none; }
li { cursor: pointer; }
a {
    background: red;
    float: left;
    width: 100px;
    height: 100px;
    cursor: help;
    display: block; }
li:after {
    content: "";
    background: yellow;
    float: left;
    width: 100px;
    height: 100px;
    display: block; }

这篇关于cursor:指针不工作在:元素之后?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆