我正在 Chrome 中查看以下示例,但似乎无法获得 cursor: pointer
在 :after
上工作li
的元素.有办法解决这个问题吗?
最佳答案
不是在 :after
元素上设置 cursor: pointer
,而是在整个 li
上设置它,它将同时显示在两个元素上.
编辑:
对于那些试图在 li
及其 :after
伪元素上使用不同光标的人,您只需显式定义 cursor
属性li
中的内容。请参阅此更新的 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; }
关于html - 光标 : pointer doesn't work on :after element?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6296239/