Is there a single element anchored in CSS that supports pseudo-style properties?

I was thinking about using these styles to simplify the rollover effects of cells in the datagrid, but I can't get these styles to work for anything other than the main tag itself.

Is the anchor tag the <a>

only HTML element to support styles like hover, active, visited?

+1


source to share


5 answers


It should work on all elements, but IE6 only supports links. I've used anything: hover to get around this.



+2


source


Modern browsers support pseudo-style properties for all elements, IE6 is the only current mainstream browser that doesn't (and that's only for the: hover property).



Unfortunately, until IE6 usage falls below minimum levels, you should avoid using the: hover property on non-anchored elements for better cross-browser support. Alternatively, you can provide IE6 support for it using javascript (with browser detection) or CSS expressions .

+2


source


According to the CSS2 spec :

CSS does not define what elements can be in the above states [: hover,: active and: focus], or how states are entered and left.

In other words, don't depend on their work at all. I would use Javascript along with CSS to get a wider audience.

0


source


The PPK has a great browser link: http://www.quirksmode.org/css/contents.html#t16

It displays browsers that correctly support the: hover pseudo vector (and a bunch of other css selectors).

0


source


Yes, unfortunately anchor is the only tag that supports these styles.

I would recommend the following: Before coding any of your own JS, try using the JQuery framework, it can save a ton of effort.

Another crazy workaround would be to increase the size of the used style to 100% of the parent (cell), this way you effectively apply the style to the cell.

-2


source







All Articles