Does Chrome have issue with setting a:visited css properties?
Instead, use the following:
a {
background-color: white;
}
a:visited{
background-color: red;
}
For security reasons -- specifically, in order to prevent history sniffing -- Chrome limits very strictly what can be done using the :visited selector.
Why doesn't this a:visited css style work?
Actually, this has nothing to do with case sensitivity. This is a security feature. The functionality of :visited
pseudoclass has been restricted in many modern browsers (Fx4, IE9, Chrome) to prevent CSS exploit: read about it here.
Nowadays, getComputedStyle()
in these browsers usually returns values for visited links as if they weren't visited. However, I can simply imagine circumventing of that: using font-weight
for visited links, the element's width changes so browsers that would allow changing font-weight
for :visited
links wouldn't actually fix the security hole.
You can see there are some specific things browsers do to protect against this:
- The
window.getComputedStyle
method, and similar functions such aselement.querySelector
, will always return values indicating that a user has never visited any of the links on a page.- If you use a sibling selector such as
:visited + span
, the adjacent element (span in this example) will be styled as if the link were unvisited.- In rare scenarios, if you're using nested link elements and the element being matched is different from the link whose presence in history is being tested, the element will be rendered as if the link were unvisited, as well.
Thus, there's no workaround for this issue.
Chrome doesn't respect a color when link is visited
If you're having issues with the visited color being overwritten by the browser defaults, are you able to instead set all to unset?
#popup {
all: initial;
}
#popup * {
all: unset;
display: block;
}
After looking around, not 100% sure why the browser color was overriding the visited anchor, even testing #popup * {color: initial;}
rule worked, so I'm not sure what underlying mechanism is changing the text color. But looking over at the answer provided here https://stackoverflow.com/a/15903168/1440950 using unset clears the values as desired
Google chrome a:visited background image not working
Same problem here.
Changing background-position in a CSS Sprite on a:visited is working for me in Firefox 3.6 but not in Chrome 6.
But probably soon it will stop working in Firefox too. (maybe for FF 4?)
It's a privacy problem, and you can read here a Mozilla article about it (March 2010) http://hacks.mozilla.org/2010/03/privacy-related-changes-coming-to-css-vistited/
And the bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=147777#c160
I think only possible solution is to use creatively the background-color instead of images.
CSS link display issue in Chrome and Safari
This is not a bug, it's a feature. It was possible for a site to sniff the browser history through :visited-styles. You will only be able to style :visited in a way that doesn't affect the metrics of the link, which adding a border would. The same feature is coming to Fx4. (Source, MDC)
Why are certain CSS properties not applied to a:visited?
You're not doing anything wrong - it just doesn't work that way (anymore). Styling of :visited was used as a security hole, so browser manufacturers basically eliminated alternate styling for :visited except for a handful of properties (e.g. 'color', 'background-color')
See: http://hacks.mozilla.org/2010/03/privacy-related-changes-coming-to-css-vistited/
Google Chrome CSS class pseudo-class group not working
Here you set .cat a:link
and all a:visited
to black color - all a in .cat
and all a in hole css a:visited
are set to black..
.cat a:link, a:visited {
.....
}
Here you set .menu a:link
and a:visited
to white. So all a:visited
will be white... Not only in .menu...
.menu a:link,a:visited {
.....
}
I think you have mistake in .cat a:link, a:visited
- it should be .cat a:link, .cat a:visited
. Same mistake in .menu a:link, a:visited
- this should be .menu a:link, .menu a:visited
Strange css3 transition behavior with a:visited
Adding this code:
a:visited a:hover{
width: 17em;
background: #B2CDE0;
}
results (at least in Chromium) that the background color at the end of the effect is blue, but not during the ease-out. seems like a webkit bug to me
Related Topics
Jquery-Ui Datepicker CSS Problem
Different Timing Functions for Different Parts of CSS3 Keyframe Animation? (Accurate Bounce)
What Is Better: CSS Media Queries or Jquery Mobile
Setting CSS Style Attributes with Thymeleaf
How to Hack Unsupported Mix-Blend-Mode CSS Property
ASP.NET MVC 4 Minification & Background Images
How to Style Qpushbutton's Checked State to Remove Grey Dots
Can Relative Paths Be Used for @Font-Face Src
How to Set Maximum Number of Rows in a Flexbox Container and Hide Extra Element
Twitter Bootstrap Custom Carousel Indicators
CSS Inverted Trapezium When Width Will Differ
HTML5 Image Icon to Input Placeholder
Why Is My CSS Media Query Being Ignored or Overridden
Why <Ul> Adds Extra Top Margin