开发者

CSS ::after with ::selection?

I am trying to write a selector like this, but to no success:

.something::after::selection

Basically I am already using ::after to inject some content, namely an image. But I want to prevent the user from being able to "select" t开发者_JAVA技巧his image and get an ugly blue back-shadow.

Normally I can prevent this with the following:

.something::selection
{
    background-color: transparent;
}

But it does not seem to combine well with ::after.

Has anyone tried this before or have a solution?


No, in firefox I'm 100% sure that you can't change that effect on selected images, is system-specific, and not customizable yet

*edited


To prevent images to be selected you can use following css:

img { 
    -o-user-select: none;
    -moz-user-select: none;
    -webkit-user-select: none;
    user-select: none; 
}

Also see the updated jsfiddle.

With ::after see this jsfiddle.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜