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
318 views
in Technique[技术] by (71.8m points)

html - Underlining visited links

Given the following example: http://jsfiddle.net/A8v9x/4/ - when you click the first link and then come back to the page, the first link turns green. However, it still does not have an underline, even though visited links are declared to have text-decoration:underline;. Nothing changes even if you add !important to that rule.

Could not find any information about such behavior in CSS spec. Is it a common browser bug? How does one work around it?

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

You can't change text-decoration in :visited. This is out of privacy concerns which are discussed at https://developer.mozilla.org/en/CSS/Privacy_and_the_:visited_selector. Basically changing computed properties can allow websites to determine which sites a user has visited.

The CSS properties that can be used to style visited links are color, background-color, border-*-color, outline-color and, column-rule-color and, when both the unvisited and visited styles are colors (not paint servers or none), the fill and stroke properties. For properties that are not permitted (and for the alpha components of the permitted properties, when rgba() or hsla() colors or transparent are used), the style for unvisited links is used instead.


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

...