Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

css - a:visited links - opacity not working

I'm trying to make it so that when a link has been visited, it is persistently a certain color AND a certain opacity that matches non-visited links when WebKit fully transitions them.

Using this:

a:visited {
    color:#cc7839;
    opacity:0.1;
}

I can get the visited links to always be that color, except opacity isn't doing anything. I set it to 0.1 to make it easier to see if it was working.

When I hover over a visited link, it transitions to the opaque color set by WebKit for a:link:hover.

Here's the CSS that's in another file for setting all links:

a:link:hover,a:hover,a:visited:hover {
    color: #cc7839;
    opacity:0.8;
    text-decoration:none;
    -webkit-transition:all 0.5s ease-in; 
    -moz-transition:all 0.5s ease-in;
}

I'm thinking I have to change something with the latter CSS in terms of which a elements it specifies?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Not possible. You can only use the :visited selector to change the color of an element. Thus opacity doesn't work.

SEC7115

:visited and :link styles can only differ by color.

Reference here - Was unable to find W3 documentation stating it..


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...